diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e863002..89c63b2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,14 +1,26 @@ name: Checks -on: push +on: + push: + branches: + - master + pull_request: + jobs: - build: + checks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install modules - run: yarn - - name: Run tsc + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'yarn' + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Run TypeScript run: yarn run typescript - name: Run ESLint run: yarn run lint + - name: Build + run: yarn build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d610bab --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release + +on: + release: + types: [published] + +jobs: + publish: + if: ${{ !github.event.release.prerelease }} + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + cache: 'yarn' + + - name: Verify npm version + run: npm --version + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Publish to npm + # --access public: Scoped packages (@openspacelabs/*) default to private, this makes it public + # id-token: write (above) enables --provenance for signed attestations, not registry auth + run: npm publish --access public --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index 9da6239..a53e88a 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,9 @@ npm-debug.log yarn-debug.log yarn-error.log +# Build output +/lib/ + # BUCK buck-out/ \.buckd/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9c29109..44da1b2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,17 +76,30 @@ Our pre-commit hooks verify that your commit message matches this format when co We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. -Our pre-commit hooks verify that the linter and tests pass when committing. +Our pre-commit hooks verify that the linter and type checks pass when committing. + +### Build Process + +The library source code in `src/` is built to `lib/` for distribution. The `lib/` directory is not tracked in git. + +- **Local development**: No build needed - the example app reads directly from `src/` +- **Pull requests**: CI automatically builds to verify there are no build errors +- **Releases**: GitHub Actions automatically builds and publishes to npm + +You don't need to run build commands locally unless testing the built output. ### Publishing to npm -We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc. +We use [release-it](https://github.com/release-it/release-it) to create releases and [GitHub Actions](.github/workflows/release.yml) to build and publish to npm. -To publish new versions, run the following: +To publish new versions: -```sh -yarn release -``` +1. Run `yarn release` locally (creates git tag and GitHub release) +2. GitHub Actions automatically builds and publishes to npm + +Only maintainers with permission to create releases can publish. The repository must have an `NPM_TOKEN` secret configured (Settings → Secrets and variables → Actions) for CI to publish to npm. + +> **Note:** GitHub pre-releases (e.g. `v3.0.0-beta.1`) intentionally skip the npm publish step to prevent beta versions from being tagged as `latest`. The CI job will show as "Skipped" — this is expected. To publish a pre-release manually, build locally and run `npm publish --tag beta --access public`. ### Scripts diff --git a/lib/commonjs/ReactNativeZoomableView.js b/lib/commonjs/ReactNativeZoomableView.js deleted file mode 100644 index 6937908..0000000 --- a/lib/commonjs/ReactNativeZoomableView.js +++ /dev/null @@ -1,1055 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = exports.ReactNativeZoomableView = void 0; - -var _lodash = require("lodash"); - -var _react = _interopRequireWildcard(require("react")); - -var _reactNative = require("react-native"); - -var _animations = require("./animations"); - -var _components = require("./components"); - -var _StaticPin = require("./components/StaticPin"); - -var _debugHelper = require("./debugHelper"); - -var _helper = require("./helper"); - -var _coordinateConversion = require("./helper/coordinateConversion"); - -var _jsxRuntime = require("react/jsx-runtime"); - -function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } - -const initialState = { - originalWidth: 0, - originalHeight: 0, - originalPageX: 0, - originalPageY: 0, - originalX: 0, - originalY: 0, - pinSize: { - width: 0, - height: 0 - } -}; - -class ReactNativeZoomableView extends _react.Component { - static defaultProps = { - zoomEnabled: true, - panEnabled: true, - initialZoom: 1, - initialOffsetX: 0, - initialOffsetY: 0, - maxZoom: 1.5, - minZoom: 0.5, - pinchToZoomInSensitivity: 1, - pinchToZoomOutSensitivity: 1, - movementSensibility: 1, - doubleTapDelay: 300, - zoomStep: 0.5, - onLongPress: null, - longPressDuration: 700, - contentWidth: undefined, - contentHeight: undefined, - visualTouchFeedbackEnabled: true, - staticPinPosition: undefined, - staticPinIcon: undefined, - onStaticPinPositionChange: undefined, - onStaticPinPositionMove: undefined, - disablePanOnInitialZoom: false - }; - panAnim = new _reactNative.Animated.ValueXY({ - x: 0, - y: 0 - }); - zoomAnim = new _reactNative.Animated.Value(1); - offsetX = 0; - offsetY = 0; - zoomLevel = 1; - lastGestureCenterPosition = null; - lastGestureTouchDistance = null; - _gestureStarted = false; - - set gestureStarted(v) { - this._gestureStarted = v; - } - - get gestureStarted() { - return this._gestureStarted; - } - /** - * Last press time (used to evaluate whether user double tapped) - * @type {number} - */ - - - longPressTimeout = null; - touches = []; - - constructor(props) { - super(props); // This needs to be done before anything else to initialize the state. - // Otherwise, the logic below may reference the state when it's undefined, - // causing runtime errors. - - this.state = { ...initialState - }; - this.gestureHandlers = _reactNative.PanResponder.create({ - onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder, - onPanResponderGrant: this._handlePanResponderGrant, - onPanResponderMove: this._handlePanResponderMove, - onPanResponderRelease: this._handlePanResponderEnd, - onPanResponderTerminate: (evt, gestureState) => { - // We should also call _handlePanResponderEnd - // to properly perform cleanups when the gesture is terminated - // (aka gesture handling responsibility is taken over by another component). - // This also fixes a weird issue where - // on real device, sometimes onPanResponderRelease is not called when you lift 2 fingers up, - // but onPanResponderTerminate is called instead for no apparent reason. - this._handlePanResponderEnd(evt, gestureState); - - this.props.onPanResponderTerminate?.(evt, gestureState, this._getZoomableViewEventObject()); - }, - onPanResponderTerminationRequest: (evt, gestureState) => !!this.props.onPanResponderTerminationRequest?.(evt, gestureState, this._getZoomableViewEventObject()), - // Defaults to true to prevent parent components, such as React Navigation's tab view, from taking over as responder. - onShouldBlockNativeResponder: (evt, gestureState) => this.props.onShouldBlockNativeResponder?.(evt, gestureState, this._getZoomableViewEventObject()) ?? true, - onStartShouldSetPanResponderCapture: (evt, gestureState) => !!this.props.onStartShouldSetPanResponderCapture?.(evt, gestureState), - onMoveShouldSetPanResponderCapture: (evt, gestureState) => !!this.props.onMoveShouldSetPanResponderCapture?.(evt, gestureState) - }); - this.zoomSubjectWrapperRef = /*#__PURE__*/(0, _react.createRef)(); - if (this.props.zoomAnimatedValue) this.zoomAnim = this.props.zoomAnimatedValue; - if (this.props.panAnimatedValueXY) this.panAnim = this.props.panAnimatedValueXY; - if (this.props.initialZoom) this.zoomLevel = this.props.initialZoom; - if (this.props.initialOffsetX != null) this.offsetX = this.props.initialOffsetX; - if (this.props.initialOffsetY != null) this.offsetY = this.props.initialOffsetY; - this.panAnim.setValue({ - x: this.offsetX, - y: this.offsetY - }); - this.zoomAnim.setValue(this.zoomLevel); - this.panAnim.addListener(({ - x, - y - }) => { - this.offsetX = x; - this.offsetY = y; - }); - this.zoomAnim.addListener(({ - value - }) => { - this.zoomLevel = value; - }); - this.lastGestureTouchDistance = 150; - this.gestureType = null; - } - - componentDidUpdate(prevProps, prevState) { - const { - zoomEnabled, - initialZoom - } = this.props; - - if (prevProps.zoomEnabled && !zoomEnabled && initialZoom) { - this.zoomLevel = initialZoom; - this.zoomAnim.setValue(this.zoomLevel); - } - - if (!this.onTransformInvocationInitialized && this._invokeOnTransform().successful) { - this.panAnim.addListener(() => this._invokeOnTransform()); - this.zoomAnim.addListener(() => this._invokeOnTransform()); - this.onTransformInvocationInitialized = true; - } - - const currState = this.state; - const originalMeasurementsChanged = currState.originalHeight !== prevState.originalHeight || currState.originalWidth !== prevState.originalWidth || currState.originalPageX !== prevState.originalPageX || currState.originalPageY !== prevState.originalPageY || currState.originalX !== prevState.originalX || currState.originalY !== prevState.originalY; - const staticPinPositionChanged = prevProps.staticPinPosition?.x !== this.props.staticPinPosition?.x || prevProps.staticPinPosition?.y !== this.props.staticPinPosition?.y; // We use a custom `onLayout` event, so the clients can stay in-sync - // with when the internal measurements are actually saved to the state, - // thus helping them apply transformations at more accurate timings - - if (originalMeasurementsChanged) { - const layout = { - width: currState.originalWidth, - height: currState.originalHeight, - x: currState.originalX, - y: currState.originalY - }; - this.props.onLayout?.({ - nativeEvent: { - layout - } - }); - } - - if (this.onTransformInvocationInitialized && (originalMeasurementsChanged || staticPinPositionChanged)) { - this._invokeOnTransform(); - } - } - - componentDidMount() { - this.measureZoomSubject(); // We've already run `grabZoomSubjectOriginalMeasurements` at various events - // to make sure the measurements are promptly updated. - // However, there might be cases we haven't accounted for, especially when - // native processes are involved. To account for those cases, - // we'll use an interval here to ensure we're always up-to-date. - // The `setState` in `grabZoomSubjectOriginalMeasurements` won't trigger a rerender - // if the values given haven't changed, so we're not running performance risk here. - - this.measureZoomSubjectInterval = setInterval(this.measureZoomSubject, 1e3); - } - - componentWillUnmount() { - this.measureZoomSubjectInterval && clearInterval(this.measureZoomSubjectInterval); - } - - debouncedOnStaticPinPositionChange = (0, _lodash.debounce)(position => this.props.onStaticPinPositionChange?.(position), 100); - /** - * try to invoke onTransform - * @private - */ - - _invokeOnTransform() { - const zoomableViewEvent = this._getZoomableViewEventObject(); - - const position = this._staticPinPosition(); - - if (!zoomableViewEvent.originalWidth || !zoomableViewEvent.originalHeight) return { - successful: false - }; - this.props.onTransform?.(zoomableViewEvent); - - if (position) { - this.props.onStaticPinPositionMove?.(position); - this.debouncedOnStaticPinPositionChange(position); - } - - return { - successful: true - }; - } - /** - * Returns additional information about components current state for external event hooks - * - * @returns {{}} - * @private - */ - - - _getZoomableViewEventObject(overwriteObj = {}) { - return { - zoomLevel: this.zoomLevel, - offsetX: this.offsetX, - offsetY: this.offsetY, - originalHeight: this.state.originalHeight, - originalWidth: this.state.originalWidth, - originalPageX: this.state.originalPageX, - originalPageY: this.state.originalPageY, - ...overwriteObj - }; - } - /** - * Get the original box dimensions and save them for later use. - * (They will be used to calculate boxBorders) - * - * @private - */ - - - measureZoomSubject = () => { - // make sure we measure after animations are complete - requestAnimationFrame(() => { - // this setTimeout is here to fix a weird issue on iOS where the measurements are all `0` - // when navigating back (react-navigation stack) from another view - // while closing the keyboard at the same time - setTimeout(() => { - // In normal conditions, we're supposed to measure zoomSubject instead of its wrapper. - // However, our zoomSubject may have been transformed by an initial zoomLevel or offset, - // in which case these measurements will not represent the true "original" measurements. - // We just need to make sure the zoomSubjectWrapper perfectly aligns with the zoomSubject - // (no border, space, or anything between them) - this.zoomSubjectWrapperRef.current?.measure((x, y, width, height, pageX, pageY) => { - // When the component is off-screen, these become all 0s, so we don't set them - // to avoid messing up calculations, especially ones that are done right after - // the component transitions from hidden to visible. - if (!pageX && !pageY && !width && !height) return; // If these values are all the same, don't re-set them in state - // this way we don't re-render - - if (this.state.originalX === x && this.state.originalY === y && this.state.originalWidth === width && this.state.originalHeight === height && this.state.originalPageX === pageX && this.state.originalPageY === pageY) { - return; - } - - this.setState({ - originalX: x, - originalY: y, - originalWidth: width, - originalHeight: height, - originalPageX: pageX, - originalPageY: pageY - }); - }); - }); - }); - }; - /** - * Handles the start of touch events and checks for taps - * - * @param e - * @param gestureState - * @returns {boolean} - * - * @private - */ - - _handleStartShouldSetPanResponder = (e, gestureState) => { - if (this.props.onStartShouldSetPanResponder) { - this.props.onStartShouldSetPanResponder(e, gestureState, this._getZoomableViewEventObject(), false); - } // Always set pan responder on start - // of gesture so we can handle tap. - // "Pan threshold validation" will be handled - // in `onPanResponderMove` instead of in `onMoveShouldSetPanResponder` - - - return true; - }; - /** - * Calculates pinch distance - * - * @param e - * @param gestureState - * @private - */ - - _handlePanResponderGrant = (e, gestureState) => { - if (this.props.onLongPress) { - e.persist(); - this.longPressTimeout = setTimeout(() => { - this.props.onLongPress?.(e, gestureState, this._getZoomableViewEventObject()); - this.longPressTimeout = null; - }, this.props.longPressDuration); - } - - this.props.onPanResponderGrant?.(e, gestureState, this._getZoomableViewEventObject()); - this.panAnim.stopAnimation(); - this.zoomAnim.stopAnimation(); - this.gestureStarted = true; - }; - /** - * Handles the end of touch events - * - * @param e - * @param gestureState - * - * @private - */ - - _handlePanResponderEnd = (e, gestureState) => { - if (!this.gestureType) { - this._resolveAndHandleTap(e); - } - - this.setState({ - debugPoints: [] - }); - this.lastGestureCenterPosition = null; - - if (this.longPressTimeout) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } - - this.props.onPanResponderEnd?.(e, gestureState, this._getZoomableViewEventObject()); - - if (this.gestureType === 'pinch') { - this.props.onZoomEnd?.(e, gestureState, this._getZoomableViewEventObject()); - } else if (this.gestureType === 'shift') { - this.props.onShiftingEnd?.(e, gestureState, this._getZoomableViewEventObject()); - } - - if (this.props.staticPinPosition) { - this._updateStaticPin(); - } - - this.gestureType = null; - this.gestureStarted = false; - }; - /** - * Handles the actual movement of our pan responder - * - * @param e - * @param gestureState - * - * @private - */ - - _handlePanResponderMove = (e, gestureState) => { - if (this.props.onPanResponderMove) { - if (this.props.onPanResponderMove(e, gestureState, this._getZoomableViewEventObject())) { - return false; - } - } // Only supports 2 touches and below, - // any invalid number will cause the gesture to end. - - - if (gestureState.numberActiveTouches <= 2) { - if (!this.gestureStarted) { - this._handlePanResponderGrant(e, gestureState); - } - } else { - if (this.gestureStarted) { - this._handlePanResponderEnd(e, gestureState); - } - - return true; - } - - if (gestureState.numberActiveTouches === 2) { - if (this.longPressTimeout) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } // change some measurement states when switching gesture to ensure a smooth transition - - - if (this.gestureType !== 'pinch') { - this.lastGestureCenterPosition = (0, _helper.calcGestureCenterPoint)(e, gestureState); - this.lastGestureTouchDistance = (0, _helper.calcGestureTouchDistance)(e, gestureState); - } - - this.gestureType = 'pinch'; - - this._handlePinching(e, gestureState); - } else if (gestureState.numberActiveTouches === 1) { - if (this.longPressTimeout && (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5)) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } // change some measurement states when switching gesture to ensure a smooth transition - - - if (this.gestureType !== 'shift') { - this.lastGestureCenterPosition = (0, _helper.calcGestureCenterPoint)(e, gestureState); - } - - const { - dx, - dy - } = gestureState; - const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2; - - if (isShiftGesture) { - this.gestureType = 'shift'; - - this._handleShifting(gestureState); - } - } - }; - /** - * Handles the pinch movement and zooming - * - * @param e - * @param gestureState - * - * @private - */ - - _handlePinching(e, gestureState) { - if (!this.props.zoomEnabled) return; - const { - maxZoom, - minZoom, - pinchToZoomInSensitivity, - pinchToZoomOutSensitivity - } = this.props; - const distance = (0, _helper.calcGestureTouchDistance)(e, gestureState); - - if (this.props.onZoomBefore && this.props.onZoomBefore(e, gestureState, this._getZoomableViewEventObject())) { - return; - } - - if (!distance) return; - if (!this.lastGestureTouchDistance) return; // define the new zoom level and take zoom level sensitivity into consideration - - const zoomGrowthFromLastGestureState = distance / this.lastGestureTouchDistance; - this.lastGestureTouchDistance = distance; - const pinchToZoomSensitivity = zoomGrowthFromLastGestureState < 1 ? pinchToZoomOutSensitivity : pinchToZoomInSensitivity; - if (pinchToZoomSensitivity == null) return; - const deltaGrowth = zoomGrowthFromLastGestureState - 1; // 0 - no resistance - // 10 - 90% resistance - - const deltaGrowthAdjustedBySensitivity = deltaGrowth * (1 - pinchToZoomSensitivity * 9 / 100); - let newZoomLevel = this.zoomLevel * (1 + deltaGrowthAdjustedBySensitivity); // make sure max and min zoom levels are respected - - if (maxZoom != null && newZoomLevel > maxZoom) { - newZoomLevel = maxZoom; - } - - if (minZoom != null && newZoomLevel < minZoom) { - newZoomLevel = minZoom; - } - - const gestureCenterPoint = (0, _helper.calcGestureCenterPoint)(e, gestureState); - if (!gestureCenterPoint) return; - let zoomCenter = { - x: gestureCenterPoint.x - this.state.originalPageX, - y: gestureCenterPoint.y - this.state.originalPageY - }; - - if (this.props.staticPinPosition) { - // When we use a static pin position, the zoom centre is the same as that position, - // otherwise the pin moves around way too much while zooming. - zoomCenter = { - x: this.props.staticPinPosition.x, - y: this.props.staticPinPosition.y - }; - } // Uncomment to debug - - - this.props.debug && this._setPinchDebugPoints(e, zoomCenter); - const { - originalHeight, - originalWidth - } = this.state; - const oldOffsetX = this.offsetX; - const oldOffsetY = this.offsetY; - const oldScale = this.zoomLevel; - const newScale = newZoomLevel; - if (!originalHeight || !originalWidth) return; - let offsetY = (0, _helper.calcNewScaledOffsetForZoomCentering)(oldOffsetY, originalHeight, oldScale, newScale, zoomCenter.y); - let offsetX = (0, _helper.calcNewScaledOffsetForZoomCentering)(oldOffsetX, originalWidth, oldScale, newScale, zoomCenter.x); - - const offsetShift = this._calcOffsetShiftSinceLastGestureState(gestureCenterPoint); - - if (offsetShift) { - offsetX += offsetShift.x; - offsetY += offsetShift.y; - } - - this.offsetX = offsetX; - this.offsetY = offsetY; - this.zoomLevel = newScale; - this.panAnim.setValue({ - x: this.offsetX, - y: this.offsetY - }); - this.zoomAnim.setValue(this.zoomLevel); - this.props.onZoomAfter?.(e, gestureState, this._getZoomableViewEventObject()); - } - /** - * Used to debug pinch events - * @param gestureResponderEvent - * @param zoomCenter - * @param points - */ - - - _setPinchDebugPoints(gestureResponderEvent, zoomCenter, ...points) { - const { - touches - } = gestureResponderEvent.nativeEvent; - const { - originalPageY, - originalPageX - } = this.state; - this.setState({ - debugPoints: [{ - x: touches[0].pageX - originalPageX, - y: touches[0].pageY - originalPageY - }, { - x: touches[1].pageX - originalPageX, - y: touches[1].pageY - originalPageY - }, zoomCenter, ...points] - }); - } - /** - * Calculates the amount the offset should shift since the last position during panning - * - * @param {Vec2D} gestureCenterPoint - * - * @private - */ - - - _calcOffsetShiftSinceLastGestureState(gestureCenterPoint) { - const { - movementSensibility - } = this.props; - let shift = null; - - if (this.lastGestureCenterPosition && movementSensibility) { - const dx = gestureCenterPoint.x - this.lastGestureCenterPosition.x; - const dy = gestureCenterPoint.y - this.lastGestureCenterPosition.y; - const shiftX = dx / this.zoomLevel / movementSensibility; - const shiftY = dy / this.zoomLevel / movementSensibility; - shift = { - x: shiftX, - y: shiftY - }; - } - - this.lastGestureCenterPosition = gestureCenterPoint; - return shift; - } - /** - * Handles movement by tap and move - * - * @param gestureState - * - * @private - */ - - - _handleShifting(gestureState) { - // Skips shifting if panEnabled is false or disablePanOnInitialZoom is true and we're on the initial zoom level - if (!this.props.panEnabled || this.props.disablePanOnInitialZoom && this.zoomLevel === this.props.initialZoom) { - return; - } - - const shift = this._calcOffsetShiftSinceLastGestureState({ - x: gestureState.moveX, - y: gestureState.moveY - }); - - if (!shift) return; - const offsetX = this.offsetX + shift.x; - const offsetY = this.offsetY + shift.y; - - if (this.props.debug && this.state.originalPageX && this.state.originalPageY) { - const x = gestureState.moveX - this.state.originalPageX; - const y = gestureState.moveY - this.state.originalPageY; - this.setState({ - debugPoints: [{ - x, - y - }] - }); - } - - this._setNewOffsetPosition(offsetX, offsetY); - } - /** - * Set the state to offset moved - * - * @param {number} newOffsetX - * @param {number} newOffsetY - * @returns - */ - - - _setNewOffsetPosition(newOffsetX, newOffsetY) { - const { - onShiftingBefore, - onShiftingAfter - } = this.props; - - if (onShiftingBefore?.(null, null, this._getZoomableViewEventObject())) { - return; - } - - this.offsetX = newOffsetX; - this.offsetY = newOffsetY; - this.panAnim.setValue({ - x: this.offsetX, - y: this.offsetY - }); - this.zoomAnim.setValue(this.zoomLevel); - onShiftingAfter?.(null, null, this._getZoomableViewEventObject()); - } - /** - * Check whether the press event is double tap - * or single tap and handle the event accordingly - * - * @param e - * - * @private - */ - - - _resolveAndHandleTap = e => { - const now = Date.now(); - - if (this.doubleTapFirstTapReleaseTimestamp && this.props.doubleTapDelay && now - this.doubleTapFirstTapReleaseTimestamp < this.props.doubleTapDelay) { - this.doubleTapFirstTap && this._addTouch({ ...this.doubleTapFirstTap, - id: now.toString(), - isSecondTap: true - }); - this.singleTapTimeoutId && clearTimeout(this.singleTapTimeoutId); - delete this.doubleTapFirstTapReleaseTimestamp; - delete this.singleTapTimeoutId; - delete this.doubleTapFirstTap; - - this._handleDoubleTap(e); - } else { - this.doubleTapFirstTapReleaseTimestamp = now; - this.doubleTapFirstTap = { - id: now.toString(), - x: e.nativeEvent.pageX - this.state.originalPageX, - y: e.nativeEvent.pageY - this.state.originalPageY - }; - - this._addTouch(this.doubleTapFirstTap); // persist event so e.nativeEvent is preserved after a timeout delay - - - e.persist(); - this.singleTapTimeoutId = setTimeout(() => { - delete this.doubleTapFirstTapReleaseTimestamp; - delete this.singleTapTimeoutId; // Pan to the tapped location - - if (this.props.staticPinPosition && this.doubleTapFirstTap) { - const tapX = this.props.staticPinPosition.x - this.doubleTapFirstTap.x; - const tapY = this.props.staticPinPosition.y - this.doubleTapFirstTap.y; - - _reactNative.Animated.timing(this.panAnim, { - toValue: { - x: this.offsetX + tapX / this.zoomLevel, - y: this.offsetY + tapY / this.zoomLevel - }, - useNativeDriver: true, - duration: 200 - }).start(() => { - this._updateStaticPin(); - }); - } - - this.props.onSingleTap?.(e, this._getZoomableViewEventObject()); - }, this.props.doubleTapDelay); - } - }; - moveStaticPinTo = (position, duration) => { - const { - originalWidth, - originalHeight - } = this.state; - const { - staticPinPosition, - contentWidth, - contentHeight - } = this.props; - if (!staticPinPosition) return; - if (!originalWidth || !originalHeight) return; - if (!contentWidth || !contentHeight) return; // Offset for the static pin - - const pinX = staticPinPosition.x - originalWidth / 2; - const pinY = staticPinPosition.y - originalHeight / 2; - this.offsetX = contentWidth / 2 - position.x + pinX / this.zoomLevel; - this.offsetY = contentHeight / 2 - position.y + pinY / this.zoomLevel; - - if (duration) { - _reactNative.Animated.timing(this.panAnim, { - toValue: { - x: this.offsetX, - y: this.offsetY - }, - useNativeDriver: true, - duration - }).start(); - } else { - this.panAnim.setValue({ - x: this.offsetX, - y: this.offsetY - }); - } - }; - _staticPinPosition = () => { - if (!this.props.staticPinPosition) return; - if (!this.props.contentWidth || !this.props.contentHeight) return; - return (0, _coordinateConversion.viewportPositionToImagePosition)({ - viewportPosition: { - x: this.props.staticPinPosition.x, - y: this.props.staticPinPosition.y - }, - imageSize: { - height: this.props.contentHeight, - width: this.props.contentWidth - }, - zoomableEvent: { ...this._getZoomableViewEventObject(), - offsetX: this.offsetX, - offsetY: this.offsetY, - zoomLevel: this.zoomLevel - } - }); - }; - _updateStaticPin = () => { - const position = this._staticPinPosition(); - - if (!position) return; - this.props.onStaticPinPositionChange?.(position); - }; - - _addTouch(touch) { - this.touches.push(touch); - this.setState({ - touches: [...this.touches] - }); - } - - _removeTouch(touch) { - this.touches.splice(this.touches.indexOf(touch), 1); - this.setState({ - touches: [...this.touches] - }); - } - /** - * Handles the double tap event - * - * @param e - * - * @private - */ - - - _handleDoubleTap(e) { - const { - onDoubleTapBefore, - onDoubleTapAfter, - doubleTapZoomToCenter - } = this.props; - onDoubleTapBefore?.(e, this._getZoomableViewEventObject()); - - const nextZoomStep = this._getNextZoomStep(); - - if (nextZoomStep == null) return; - const { - originalPageX, - originalPageY - } = this.state; // define new zoom position coordinates - - const zoomPositionCoordinates = { - x: e.nativeEvent.pageX - originalPageX, - y: e.nativeEvent.pageY - originalPageY - }; // if doubleTapZoomToCenter enabled -> always zoom to center instead - - if (doubleTapZoomToCenter) { - zoomPositionCoordinates.x = 0; - zoomPositionCoordinates.y = 0; - } - - this.zoomTo(nextZoomStep, zoomPositionCoordinates); - onDoubleTapAfter?.(e, this._getZoomableViewEventObject({ - zoomLevel: nextZoomStep - })); - } - /** - * Returns the next zoom step based on current step and zoomStep property. - * If we are zoomed all the way in -> return to initialzoom - * - * @returns {*} - */ - - - _getNextZoomStep() { - const { - zoomStep, - maxZoom, - initialZoom - } = this.props; - const { - zoomLevel - } = this; - if (maxZoom == null) return; - - if (zoomLevel.toFixed(2) === maxZoom.toFixed(2)) { - return initialZoom; - } - - if (zoomStep == null) return; - const nextZoomStep = zoomLevel * (1 + zoomStep); - - if (nextZoomStep > maxZoom) { - return maxZoom; - } - - return nextZoomStep; - } - /** - * Zooms to a specific level. A "zoom center" can be provided, which specifies - * the point that will remain in the same position on the screen after the zoom. - * The coordinates of the zoom center is relative to the zoom subject. - * { x: 0, y: 0 } is the very center of the zoom subject. - * - * @param newZoomLevel - * @param zoomCenter - If not supplied, the container's center is the zoom center - */ - - - zoomTo(newZoomLevel, zoomCenter) { - if (!this.props.zoomEnabled) return false; - if (this.props.maxZoom && newZoomLevel > this.props.maxZoom) return false; - if (this.props.minZoom && newZoomLevel < this.props.minZoom) return false; - this.props.onZoomBefore?.(null, null, this._getZoomableViewEventObject()); // == Perform Pan Animation to preserve the zoom center while zooming == - - let listenerId = ''; - - if (zoomCenter) { - // Calculates panAnim values based on changes in zoomAnim. - let prevScale = this.zoomLevel; // Since zoomAnim is calculated in native driver, - // it will jitter panAnim once in a while, - // because here panAnim is being calculated in js. - // However the jittering should mostly occur in simulator. - - listenerId = this.zoomAnim.addListener(({ - value: newScale - }) => { - this.panAnim.setValue({ - x: (0, _helper.calcNewScaledOffsetForZoomCentering)(this.offsetX, this.state.originalWidth, prevScale, newScale, zoomCenter.x), - y: (0, _helper.calcNewScaledOffsetForZoomCentering)(this.offsetY, this.state.originalHeight, prevScale, newScale, zoomCenter.y) - }); - prevScale = newScale; - }); - } // == Perform Zoom Animation == - - - (0, _animations.getZoomToAnimation)(this.zoomAnim, newZoomLevel).start(() => { - this.zoomAnim.removeListener(listenerId); - }); // == Zoom Animation Ends == - - this.props.onZoomAfter?.(null, null, this._getZoomableViewEventObject()); - return true; - } - /** - * Zooms in or out by a specified change level - * Use a positive number for `zoomLevelChange` to zoom in - * Use a negative number for `zoomLevelChange` to zoom out - * - * Returns a promise if everything was updated and a boolean, whether it could be updated or if it exceeded the min/max zoom limits. - * - * @param {number | null} zoomLevelChange - * - * @return {bool} - */ - - - zoomBy(zoomLevelChange) { - // if no zoom level Change given -> just use zoom step - zoomLevelChange ||= this.props.zoomStep || 0; - return this.zoomTo(this.zoomLevel + zoomLevelChange); - } - /** - * Moves the zoomed view to a specified position - * Returns a promise when finished - * - * @param {number} newOffsetX the new position we want to move it to (x-axis) - * @param {number} newOffsetY the new position we want to move it to (y-axis) - * - * @return {bool} - */ - - - moveTo(newOffsetX, newOffsetY) { - const { - originalWidth, - originalHeight - } = this.state; - if (!originalWidth || !originalHeight) return; - const offsetX = (newOffsetX - originalWidth / 2) / this.zoomLevel; - const offsetY = (newOffsetY - originalHeight / 2) / this.zoomLevel; - - this._setNewOffsetPosition(-offsetX, -offsetY); - } - /** - * Moves the zoomed view by a certain amount. - * - * Returns a promise when finished - * - * @param {number} offsetChangeX the amount we want to move the offset by (x-axis) - * @param {number} offsetChangeY the amount we want to move the offset by (y-axis) - * - * @return {bool} - */ - - - moveBy(offsetChangeX, offsetChangeY) { - const offsetX = (this.offsetX * this.zoomLevel - offsetChangeX) / this.zoomLevel; - const offsetY = (this.offsetY * this.zoomLevel - offsetChangeY) / this.zoomLevel; - - this._setNewOffsetPosition(offsetX, offsetY); - } - - render() { - const { - staticPinIcon, - children, - visualTouchFeedbackEnabled, - doubleTapDelay, - staticPinPosition, - onStaticPinLongPress, - onStaticPinPress, - pinProps - } = this.props; - const { - pinSize, - touches, - debugPoints = [] - } = this.state; - return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, { - style: styles.container, - ...this.gestureHandlers.panHandlers, - ref: this.zoomSubjectWrapperRef, - onLayout: this.measureZoomSubject, - children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, { - style: [styles.zoomSubject, this.props.style, { - transform: [// In RN79, we need to split the scale into X and Y to avoid - // the content getting pixelated when zooming in - { - scaleX: this.zoomAnim - }, { - scaleY: this.zoomAnim - }, ...this.panAnim.getTranslateTransform()] - }], - children: children - }), visualTouchFeedbackEnabled && touches?.map(touch => doubleTapDelay && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.AnimatedTouchFeedback, { - x: touch.x, - y: touch.y, - animationDuration: doubleTapDelay, - onAnimationDone: () => { - this._removeTouch(touch); - } - }, touch.id)), debugPoints.map(({ - x, - y - }, index) => { - return /*#__PURE__*/(0, _jsxRuntime.jsx)(_debugHelper.DebugTouchPoint, { - x: x, - y: y - }, index); - }), staticPinPosition && /*#__PURE__*/(0, _jsxRuntime.jsx)(_StaticPin.StaticPin, { - staticPinIcon: staticPinIcon, - staticPinPosition: staticPinPosition, - pinSize: pinSize, - onPress: onStaticPinPress, - onLongPress: onStaticPinLongPress, - onParentMove: this._handlePanResponderMove, - setPinSize: size => { - this.setState({ - pinSize: size - }); - }, - pinProps: pinProps - })] - }); - } - -} - -exports.ReactNativeZoomableView = ReactNativeZoomableView; - -const styles = _reactNative.StyleSheet.create({ - container: { - alignItems: 'center', - flex: 1, - justifyContent: 'center', - overflow: 'hidden', - position: 'relative' - }, - zoomSubject: { - alignItems: 'center', - flex: 1, - justifyContent: 'center', - width: '100%' - } -}); - -var _default = exports.default = ReactNativeZoomableView; -//# sourceMappingURL=ReactNativeZoomableView.js.map \ No newline at end of file diff --git a/lib/commonjs/ReactNativeZoomableView.js.map b/lib/commonjs/ReactNativeZoomableView.js.map deleted file mode 100644 index f9806c1..0000000 --- a/lib/commonjs/ReactNativeZoomableView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["ReactNativeZoomableView.tsx"],"names":["initialState","originalWidth","originalHeight","originalPageX","originalPageY","originalX","originalY","pinSize","width","height","ReactNativeZoomableView","Component","defaultProps","zoomEnabled","panEnabled","initialZoom","initialOffsetX","initialOffsetY","maxZoom","minZoom","pinchToZoomInSensitivity","pinchToZoomOutSensitivity","movementSensibility","doubleTapDelay","zoomStep","onLongPress","longPressDuration","contentWidth","undefined","contentHeight","visualTouchFeedbackEnabled","staticPinPosition","staticPinIcon","onStaticPinPositionChange","onStaticPinPositionMove","disablePanOnInitialZoom","panAnim","Animated","ValueXY","x","y","zoomAnim","Value","offsetX","offsetY","zoomLevel","lastGestureCenterPosition","lastGestureTouchDistance","_gestureStarted","gestureStarted","v","longPressTimeout","touches","constructor","props","state","gestureHandlers","PanResponder","create","onStartShouldSetPanResponder","_handleStartShouldSetPanResponder","onPanResponderGrant","_handlePanResponderGrant","onPanResponderMove","_handlePanResponderMove","onPanResponderRelease","_handlePanResponderEnd","onPanResponderTerminate","evt","gestureState","_getZoomableViewEventObject","onPanResponderTerminationRequest","onShouldBlockNativeResponder","onStartShouldSetPanResponderCapture","onMoveShouldSetPanResponderCapture","zoomSubjectWrapperRef","zoomAnimatedValue","panAnimatedValueXY","setValue","addListener","value","gestureType","componentDidUpdate","prevProps","prevState","onTransformInvocationInitialized","_invokeOnTransform","successful","currState","originalMeasurementsChanged","staticPinPositionChanged","layout","onLayout","nativeEvent","componentDidMount","measureZoomSubject","measureZoomSubjectInterval","setInterval","componentWillUnmount","clearInterval","debouncedOnStaticPinPositionChange","position","zoomableViewEvent","_staticPinPosition","onTransform","overwriteObj","requestAnimationFrame","setTimeout","current","measure","pageX","pageY","setState","e","persist","stopAnimation","_resolveAndHandleTap","debugPoints","clearTimeout","onPanResponderEnd","onZoomEnd","onShiftingEnd","_updateStaticPin","numberActiveTouches","_handlePinching","Math","abs","dx","dy","isShiftGesture","_handleShifting","distance","onZoomBefore","zoomGrowthFromLastGestureState","pinchToZoomSensitivity","deltaGrowth","deltaGrowthAdjustedBySensitivity","newZoomLevel","gestureCenterPoint","zoomCenter","debug","_setPinchDebugPoints","oldOffsetX","oldOffsetY","oldScale","newScale","offsetShift","_calcOffsetShiftSinceLastGestureState","onZoomAfter","gestureResponderEvent","points","shift","shiftX","shiftY","moveX","moveY","_setNewOffsetPosition","newOffsetX","newOffsetY","onShiftingBefore","onShiftingAfter","now","Date","doubleTapFirstTapReleaseTimestamp","doubleTapFirstTap","_addTouch","id","toString","isSecondTap","singleTapTimeoutId","_handleDoubleTap","tapX","tapY","timing","toValue","useNativeDriver","duration","start","onSingleTap","moveStaticPinTo","pinX","pinY","viewportPosition","imageSize","zoomableEvent","touch","push","_removeTouch","splice","indexOf","onDoubleTapBefore","onDoubleTapAfter","doubleTapZoomToCenter","nextZoomStep","_getNextZoomStep","zoomPositionCoordinates","zoomTo","toFixed","listenerId","prevScale","removeListener","zoomBy","zoomLevelChange","moveTo","moveBy","offsetChangeX","offsetChangeY","render","children","onStaticPinLongPress","onStaticPinPress","pinProps","styles","container","panHandlers","zoomSubject","style","transform","scaleX","scaleY","getTranslateTransform","map","index","size","StyleSheet","alignItems","flex","justifyContent","overflow"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AAKA;;;;;;AAUA,MAAMA,YAA0C,GAAG;AACjDC,EAAAA,aAAa,EAAE,CADkC;AAEjDC,EAAAA,cAAc,EAAE,CAFiC;AAGjDC,EAAAA,aAAa,EAAE,CAHkC;AAIjDC,EAAAA,aAAa,EAAE,CAJkC;AAKjDC,EAAAA,SAAS,EAAE,CALsC;AAMjDC,EAAAA,SAAS,EAAE,CANsC;AAOjDC,EAAAA,OAAO,EAAE;AAAEC,IAAAA,KAAK,EAAE,CAAT;AAAYC,IAAAA,MAAM,EAAE;AAApB;AAPwC,CAAnD;;AAUA,MAAMC,uBAAN,SAAsCC,gBAAtC,CAGE;AAKmB,SAAZC,YAAY,GAAG;AACpBC,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2J,EAAAA,SAAS,EAAE;AACTY,IAAAA,UAAU,EAAE,QADH;AAETC,IAAAA,IAAI,EAAE,CAFG;AAGTC,IAAAA,cAAc,EAAE,QAHP;AAITC,IAAAA,QAAQ,EAAE,QAJD;AAKT/H,IAAAA,QAAQ,EAAE;AALD,GADoB;AAQ/BkH,EAAAA,WAAW,EAAE;AACXU,IAAAA,UAAU,EAAE,QADD;AAEXC,IAAAA,IAAI,EAAE,CAFK;AAGXC,IAAAA,cAAc,EAAE,QAHL;AAIX3N,IAAAA,KAAK,EAAE;AAJI;AARkB,CAAlB,CAAf;;iCAgBeE,uB","sourceRoot":"../../src"} diff --git a/lib/commonjs/animations/index.js b/lib/commonjs/animations/index.js deleted file mode 100644 index 5e465df..0000000 --- a/lib/commonjs/animations/index.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getZoomToAnimation = getZoomToAnimation; - -var _reactNative = require("react-native"); - -function getZoomToAnimation(animValue, toValue) { - return _reactNative.Animated.timing(animValue, { - easing: _reactNative.Easing.out(_reactNative.Easing.ease), - toValue, - useNativeDriver: true - }); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/animations/index.js.map b/lib/commonjs/animations/index.js.map deleted file mode 100644 index ffea7ac..0000000 --- a/lib/commonjs/animations/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["animations/index.ts"],"names":["getZoomToAnimation","animValue","toValue","Animated","timing","easing","Easing","out","ease","useNativeDriver"],"mappings":";;;;;;;AAAA;;AAEO,SAASA,kBAAT,CAA4BC,SAA5B,EAAuDC,OAAvD,EAAwE;AAC7E,SAAOC,sBAASC,MAAT,CAAgBH,SAAhB,EAA2B;AAChCI,IAAAA,MAAM,EAAEC,oBAAOC,GAAP,CAAWD,oBAAOE,IAAlB,CADwB;AAEhCN,IAAAA,OAFgC;AAGhCO,IAAAA,eAAe,EAAE;AAHe,GAA3B,CAAP;AAKD","sourceRoot":"../../../src"} diff --git a/lib/commonjs/assets/pin.png b/lib/commonjs/assets/pin.png deleted file mode 100644 index 471a758..0000000 Binary files a/lib/commonjs/assets/pin.png and /dev/null differ diff --git a/lib/commonjs/components/AnimatedTouchFeedback.js b/lib/commonjs/components/AnimatedTouchFeedback.js deleted file mode 100644 index dad651b..0000000 --- a/lib/commonjs/components/AnimatedTouchFeedback.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.AnimatedTouchFeedback = void 0; - -var _react = _interopRequireWildcard(require("react")); - -var _reactNative = require("react-native"); - -var _jsxRuntime = require("react/jsx-runtime"); - -function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } - -const AnimatedTouchFeedback = ({ - x, - y, - animationDelay, - animationDuration, - onAnimationDone -}) => { - const appearDisappearAnimRef = (0, _react.useRef)(new _reactNative.Animated.Value(0)); - const onAnimationDoneRef = (0, _react.useRef)(onAnimationDone); - onAnimationDoneRef.current = onAnimationDone; - (0, _react.useEffect)(() => { - appearDisappearAnimRef.current.setValue(0); - const inDuration = animationDuration * 0.8; - const outDuration = animationDuration - inDuration; - - _reactNative.Animated.sequence([_reactNative.Animated.timing(appearDisappearAnimRef.current, { - delay: animationDelay || 0, - toValue: 1, - duration: inDuration, - easing: _reactNative.Easing.linear, - useNativeDriver: true - }), _reactNative.Animated.timing(appearDisappearAnimRef.current, { - toValue: 0, - duration: outDuration, - easing: _reactNative.Easing.out(_reactNative.Easing.ease), - useNativeDriver: true - })]).start(() => onAnimationDoneRef.current?.()); - }, [animationDelay, animationDuration]); - return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, { - pointerEvents: "none", - style: [styles.animatedTouchFeedback, { - opacity: appearDisappearAnimRef.current.interpolate({ - inputRange: [0, 1], - outputRange: [0, 0.3] - }), - left: x - 20, - top: y - 20, - transform: [{ - scale: appearDisappearAnimRef.current.interpolate({ - inputRange: [0, 1], - outputRange: [0.5, 1] - }) - }] - }] - }); -}; - -exports.AnimatedTouchFeedback = AnimatedTouchFeedback; - -const styles = _reactNative.StyleSheet.create({ - animatedTouchFeedback: { - backgroundColor: 'lightgray', - borderRadius: 40, - height: 40, - position: 'absolute', - width: 40 - } -}); -//# sourceMappingURL=AnimatedTouchFeedback.js.map \ No newline at end of file diff --git a/lib/commonjs/components/AnimatedTouchFeedback.js.map b/lib/commonjs/components/AnimatedTouchFeedback.js.map deleted file mode 100644 index 70deb30..0000000 --- a/lib/commonjs/components/AnimatedTouchFeedback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["components/AnimatedTouchFeedback.tsx"],"names":["AnimatedTouchFeedback","x","y","animationDelay","animationDuration","onAnimationDone","appearDisappearAnimRef","Animated","Value","onAnimationDoneRef","current","setValue","inDuration","outDuration","sequence","timing","delay","toValue","duration","easing","Easing","linear","useNativeDriver","out","ease","start","styles","animatedTouchFeedback","opacity","interpolate","inputRange","outputRange","left","top","transform","scale","StyleSheet","create","backgroundColor","borderRadius","height","position","width"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAEO,MAAMA,qBAAqB,GAAG,CAAC;AACpCC,EAAAA,CADoC;AAEpCC,EAAAA,CAFoC;AAGpCC,EAAAA,cAHoC;AAIpCC,EAAAA,iBAJoC;AAKpCC,EAAAA;AALoC,CAAD,KAY/B;AACJ,QAAMC,sBAAsB,GAAG,mBAAuB,IAAIC,sBAASC,KAAb,CAAmB,CAAnB,CAAvB,C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AW,EAAE,CAAC,CAAD,EAAI,GAAJ;AAFqC,OAA3C,CADX;AAKEC,MAAAA,IAAI,EAAE/B,CAAC,GAAG,EALZ;AAMEgC,MAAAA,GAAG,EAAE/B,CAAC,GAAG,EANX;AAOEgC,MAAAA,SAAS,EAAE,CACT;AACEC,QAAAA,KAAK,EAAE7B,sBAAsB,CAACI,OAAvB,CAA+BmB,WAA/B,CAA2C;AAChDC,UAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CADoC;AAEhDC,UAAAA,WAAW,EAAE,CAAC,GAAD,EAAM,CAAN;AAFmC,SAA3C;AADT,OADS;AAPb,KAFK;AAFT,IADF;AAwBD,CA9DM;;;;AAgEP,MAAML,MAAM,GAAGU,wBAAWC,MAAX,CAAkB;AAC/BV,EAAAA,qBAAqB,EAAE;AACrBW,IAAAA,eAAe,EAAE,WADI;AAErBC,IAAAA,YAAY,EAAE,EAFO;AAGrBC,IAAAA,MAAM,EAAE,EAHa;AAIrBC,IAAAA,QAAQ,EAAE,UAJW;AAKrBC,IAAAA,KAAK,EAAE;AALc;AADQ,CAAlB,CAAf","sourceRoot":"../../../src"} diff --git a/lib/commonjs/components/StaticPin.js b/lib/commonjs/components/StaticPin.js deleted file mode 100644 index 5a601d2..0000000 --- a/lib/commonjs/components/StaticPin.js +++ /dev/null @@ -1,101 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.StaticPin = void 0; - -var _react = _interopRequireDefault(require("react")); - -var _reactNative = require("react-native"); - -var _jsxRuntime = require("react/jsx-runtime"); - -function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } - -const StaticPin = ({ - staticPinPosition, - staticPinIcon, - pinSize, - onParentMove, - onPress, - onLongPress, - setPinSize, - pinProps = {} -}) => { - const tapTime = _react.default.useRef(0); - - const transform = [{ - translateY: -pinSize.height - }, { - translateX: -pinSize.width / 2 - }]; - const opacity = pinSize.width && pinSize.height ? 1 : 0; - - const panResponder = _react.default.useRef(_reactNative.PanResponder.create({ - onStartShouldSetPanResponder: () => { - tapTime.current = Date.now(); // We want to handle tap on this so set true - - return true; - }, - onPanResponderMove: (evt, gestureState) => { - // However if the user moves finger we want to pass this evt to parent - // to handle panning (tap not recognized) - if (Math.abs(gestureState.dx) > 5 && Math.abs(gestureState.dy) > 5) onParentMove(evt, gestureState); - }, - onPanResponderRelease: (evt, gestureState) => { - if (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5) return; - const dt = Date.now() - tapTime.current; - - if (onPress && dt < 500) { - onPress(evt); - } - - if (onLongPress && dt > 500) { - // RN long press is 500ms - onLongPress(evt); - } - } - })).current; - - return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, { - style: [{ - left: staticPinPosition.x, - top: staticPinPosition.y - }, styles.pinWrapper, { - opacity, - transform - }], - ...pinProps, - children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, { - onLayout: ({ - nativeEvent: { - layout - } - }) => { - setPinSize(layout); - }, - ...panResponder.panHandlers, - children: staticPinIcon || - /*#__PURE__*/ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - (0, _jsxRuntime.jsx)(_reactNative.Image, { - source: require('../assets/pin.png'), - style: styles.pin - }) - }) - }); -}; - -exports.StaticPin = StaticPin; - -const styles = _reactNative.StyleSheet.create({ - pin: { - height: 64, - width: 48 - }, - pinWrapper: { - position: 'absolute' - } -}); -//# sourceMappingURL=StaticPin.js.map \ No newline at end of file diff --git a/lib/commonjs/components/StaticPin.js.map b/lib/commonjs/components/StaticPin.js.map deleted file mode 100644 index d0e8764..0000000 --- a/lib/commonjs/components/StaticPin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["components/StaticPin.tsx"],"names":["StaticPin","staticPinPosition","staticPinIcon","pinSize","onParentMove","onPress","onLongPress","setPinSize","pinProps","tapTime","React","useRef","transform","translateY","height","translateX","width","opacity","panResponder","PanResponder","create","onStartShouldSetPanResponder","current","Date","now","onPanResponderMove","evt","gestureState","Math","abs","dx","dy","onPanResponderRelease","dt","left","x","top","y","styles","pinWrapper","nativeEvent","layout","panHandlers","require","pin","StyleSheet","position"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAYO,MAAMA,SAAS,GAAG,CAAC;AACxBC,EAAAA,iBADwB;AAExBC,EAAAA,aAFwB;AAGxBC,EAAAA,OAHwB;AAIxBC,EAAAA,YAJwB;AAKxBC,EAAAA,OALwB;AAMxBC,EAAAA,WANwB;AAOxBC,EAAAA,UAPwB;AAQxBC,EAAAA,QAAQ,GAAG;AARa,CAAD,KAsBnB;AACJ,QAAMC,OAAO,GAAGC,eAAMC,MAAN,CAAa,CAAb,CAAhB;;AACA,QAAMC,SAAS,GAAG,CAChB;AAAEC,IAAAA,UAAU,EAAE,CAACV,OAAO,CAACW;AAAvB,GADgB,EAEhB;AAAEC,IAAAA,UAAU,EAAE,CAACZ,OAAO,CAACa,KAAT,GAAiB;AAA/B,GAFgB,CAAlB;AAKA,QAAMC,OAAO,GAAGd,OAAO,CAACa,KAAR,IAAiBb,OAAO,CAACW,MAAzB,GAAkC,CAAlC,GAAsC,CAAtD;;AAEA,QAAMI,YAAY,GAAGR,eAAMC,MAAN,CACnBQ,0BAAaC,MAAb,CAAoB;AAClBC,IAAAA,4BAA4B,EAAE,MAAM;AAClCZ,MAAAA,OAAO,CAACa,OAAR,GAAkBC,IAAI,CAACC,GAAL,EAAlB,CADkC,CAGlC;;AACA,aAAO,IAAP;AACD,KANiB;AAOlBC,IAAAA,kBAAkB,EAAE,CAACC,GAAD,EAAMC,YAAN,KAAuB;AACzC;AACA;AACA,UAAIC,IAAI,CAACC,GAAL,CAASF,YAAY,CAACG,EAAtB,IAA4B,CAA5B,IAAiCF,IAAI,CAACC,GAAL,CAASF,YAAY,CAACI,EAAtB,IAA4B,CAAjE,EACE3B,YAAY,CAACsB,GAAD,EAAMC,YAAN,CAAZ;AACH,KAZiB;AAalBK,IAAAA,qBAAqB,EAAE,C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AAG,EAAE;AACH9B,IAAAA,MAAM,EAAE,EADL;AAEHE,IAAAA,KAAK,EAAE;AAFJ,GAD0B;AAK/BuB,EAAAA,UAAU,EAAE;AACVO,IAAAA,QAAQ,EAAE;AADA;AALmB,CAAlB,CAAf","sourceRoot":"../../../src"} diff --git a/lib/commonjs/components/index.js b/lib/commonjs/components/index.js deleted file mode 100644 index ac2c097..0000000 --- a/lib/commonjs/components/index.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "AnimatedTouchFeedback", { - enumerable: true, - get: function () { - return _AnimatedTouchFeedback.AnimatedTouchFeedback; - } -}); - -var _AnimatedTouchFeedback = require("./AnimatedTouchFeedback"); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/index.js.map b/lib/commonjs/components/index.js.map deleted file mode 100644 index ae1e554..0000000 --- a/lib/commonjs/components/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["components/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourceRoot":"../../../src"} diff --git a/lib/commonjs/debugHelper/index.js b/lib/commonjs/debugHelper/index.js deleted file mode 100644 index 1f79d59..0000000 --- a/lib/commonjs/debugHelper/index.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.DebugTouchPoint = exports.DebugRect = void 0; - -var _react = _interopRequireDefault(require("react")); - -var _reactNative = require("react-native"); - -var _jsxRuntime = require("react/jsx-runtime"); - -function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } - -const DebugTouchPoint = ({ - diameter = 20, - x = 0, - y = 0, - color = 'yellow' -}) => { - const radius = diameter / 2; - return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, { - style: [styles.debugPoint, { - width: diameter, - height: diameter, - borderRadius: diameter, - backgroundColor: color, - left: x - radius, - top: y - radius - }], - pointerEvents: "none" - }); -}; - -exports.DebugTouchPoint = DebugTouchPoint; - -const DebugRect = ({ - height, - x = 0, - y = 0, - color = 'yellow' -}) => { - const width = 5; - return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, { - style: [styles.debugRect, { - width, - height, - backgroundColor: color, - left: x - width / 2, - top: y - }], - pointerEvents: "none" - }); -}; - -exports.DebugRect = DebugRect; - -const styles = _reactNative.StyleSheet.create({ - debugPoint: { - opacity: 0.7, - position: 'absolute' - }, - debugRect: { - opacity: 0.5, - position: 'absolute' - } -}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/debugHelper/index.js.map b/lib/commonjs/debugHelper/index.js.map deleted file mode 100644 index c511a3b..0000000 --- a/lib/commonjs/debugHelper/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["debugHelper/index.tsx"],"names":["DebugTouchPoint","diameter","x","y","color","radius","styles","debugPoint","width","height","borderRadius","backgroundColor","left","top","DebugRect","debugRect","StyleSheet","create","opacity","position"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAEO,MAAMA,eAAe,GAAG,CAAC;AAC9BC,EAAAA,QAAQ,GAAG,EADmB;AAE9BC,EAAAA,CAAC,GAAG,CAF0B;AAG9BC,EAAAA,CAAC,GAAG,CAH0B;AAI9BC,EAAAA,KAAK,GAAG;AAJsB,CAAD,KAKzB;AACJ,QAAMC,MAAM,GAAGJ,QAAQ,GAAG,CAA1B;AACA,sBACE,qBAAC,iBAAD;AACE,IAAA,KAAK,EAAE,CACLK,MAAM,CAACC,UADF,EAEL;AACEC,MAAAA,KAAK,EAAEP,QADT;AAEEQ,MAAAA,MAAM,EAAER,QAFV;AAGES,MAAAA,YAAY,EAAET,QAHhB;AAIEU,MAAAA,eAAe,EAAEP,KAJnB;AAKEQ,MAAAA,IAAI,EAAEV,CAAC,GAAGG,MALZ;AAMEQ,MAAAA,GAAG,EAAEV,CAAC,GAAGE;AANX,KAFK,CADT;AAYE,IAAA,aAAa,EAAC;AAZhB,IADF;AAgBD,CAvBM;;;;AAwBA,MAAMS,SAAS,GAAG,CAAC;AACxBL,EAAAA,MADwB;AAExBP,EAAAA,CAAC,GAAG,CAFoB;AAGxBC,EAAAA,CAAC,GAAG,CAHoB;AAIxBC,EAAAA,KAAK,GAAG;AAJgB,CAAD,KAUnB;AACJ,QAAMI,KAAK,GAAG,CAAd;AACA,sBACE,qBAAC,iBAAD;AACE,IAAA,KAAK,EAAE,CACLF,MAAM,CAACS,SADF,EAEL;AACEP,MAAAA,KADF;AAEEC,MAAAA,MAFF;AAGEE,MAAAA,eAAe,EAAEP,KAHnB;AAIEQ,MAAAA,IAAI,EAAEV,CAAC,GAAGM,KAAK,GAAG,CAJpB;AAKEK,MAAAA,GAAG,EAAEV;AALP,KAFK,CADT;AAWE,IAAA,aAAa,EAAC;AAXhB,IADF;AAeD,CA3BM;;;;AA6BP,MAAMG,MAAM,GAAGU,wBAAWC,MAAX,CAAkB;AAC/BV,EAAAA,UAAU,EAAE;AACVW,IAAAA,OAAO,EAAE,GADC;AAEVC,IAAAA,QAAQ,EAAE;AAFA,GADmB;AAK/BJ,EAAAA,SAAS,EAAE;AACTG,IAAAA,OAAO,EAAE,GADA;AAETC,IAAAA,QAAQ,EAAE;AAFD;AALoB,CAAlB,CAAf","sourceRoot":"../../../src"} diff --git a/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js b/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js deleted file mode 100644 index 1147132..0000000 --- a/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.calcNewScaledOffsetForZoomCentering = calcNewScaledOffsetForZoomCentering; - -/** - * Calculates the new offset for the zoomSubject to ensure zoom center position is retained after zooming. - * Parameters should correspond to whether we need the offset for the X or Y axis - * - * ## Terms Used: - * - * - Zoom Subject: the view that's being zoomed and panned - * - Zoom Center: the point whose relative position to the window is retained - * - Unscaled: a measurement in pixels denoting the true size as observed by the users' eyes - * - Scaled: a measurement in pixels scaled to the "scale transformation" of the zoom subject to match with its true size. - * *For example:* - * If the scale on the zoom subject is 0.5, - * then to draw an actual 4px line on the zoom subject, we need to scale it to 4px / 0.5 = 8px - * 8px is the scaled measurement - * - * ## Overall idea of this algorithm: - * - * When users perform zooming by pinching the screen, - * we need to shift the zoom subject so that the position of the zoom center is always the same. - * The offset amount to shift the layer is the returned value. - * - * - * ## How we achieve our goal: - * - * To retain, the zoom center position, whenever a zoom action is performed, - * we just need to make sure the distances from all the points in the zoom subject - * to the zoom center increases or decreases by the growth rate of the scale. - * - * ``` - * newDistanceAnyPointToZoomCenter = oldDistanceAnyPointToZoomCenter * (newScale/oldScale) - * ``` - * - * We can't calculate that for all the points because there are unlimited points on a plain. - * However, due to the way `transform` works in RN, every point is scaled from the zoom subject center. - * Therefore, it's sufficient to base our calculation on the distance from the zoom subject center to the zoom center. - * - * ``` - * newDistanceZoomSubjectCenterToZoomCenter = oldDistanceZoomSubjectCenterToZoomCenter * (newScale/oldScale) - * ``` - * - * Once we have `newDistanceZoomSubjectCenterToZoomCenter`, - * we can easily calculate the position of the new center, which leads us to the offset amount. - * Refer to the code for more details - * - * @param oldOffsetXOrYScaled - * @param zoomSubjectOriginalWidthOrHeight - * @param oldScale - * @param newScale - * @param zoomCenterXOrY - */ -function calcNewScaledOffsetForZoomCentering(oldOffsetXOrYScaled, zoomSubjectOriginalWidthOrHeight, oldScale, newScale, zoomCenterXOrY) { - const oldOffSetUnscaled = oldOffsetXOrYScaled * oldScale; - const growthRate = newScale / oldScale; // these act like namespaces just for the sake of readability - - const zoomSubjectOriginalCenter = {}; - const zoomSubjectCurrentCenter = {}; - const zoomSubjectNewCenter = {}; - zoomSubjectOriginalCenter.xOrY = zoomSubjectOriginalWidthOrHeight / 2; - zoomSubjectCurrentCenter.xOrY = zoomSubjectOriginalCenter.xOrY + oldOffSetUnscaled; - zoomSubjectCurrentCenter.distanceToZoomCenter = zoomSubjectCurrentCenter.xOrY - zoomCenterXOrY; - zoomSubjectNewCenter.distanceToZoomCenter = zoomSubjectCurrentCenter.distanceToZoomCenter * growthRate; - zoomSubjectNewCenter.xOrY = zoomSubjectNewCenter.distanceToZoomCenter + zoomCenterXOrY; - const newOffsetUnscaled = zoomSubjectNewCenter.xOrY - zoomSubjectOriginalCenter.xOrY; - return newOffsetUnscaled / newScale; -} -//# sourceMappingURL=calcNewScaledOffsetForZoomCentering.js.map \ No newline at end of file diff --git a/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js.map b/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js.map deleted file mode 100644 index 33ee740..0000000 --- a/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["helper/calcNewScaledOffsetForZoomCentering.ts"],"names":["calcNewScaledOffsetForZoomCentering","oldOffsetXOrYScaled","zoomSubjectOriginalWidthOrHeight","oldScale","newScale","zoomCenterXOrY","oldOffSetUnscaled","growthRate","zoomSubjectOriginalCenter","zoomSubjectCurrentCenter","zoomSubjectNewCenter","xOrY","distanceToZoomCenter","newOffsetUnscaled"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mCAAT,CACLC,mBADK,EAELC,gCAFK,EAGLC,QAHK,EAILC,QAJK,EAKLC,cALK,EAML;AACA,QAAMC,iBAAiB,GAAGL,mBAAmB,GAAGE,QAAhD;AACA,QAAMI,UAAU,GAAGH,QAAQ,GAAGD,QAA9B,CAFA,CAIA;;AACA,QAAMK,yBAAyB,GAAG,EAAlC;AACA,QAAMC,wBAAwB,GAAG,EAAjC;AACA,QAAMC,oBAAoB,GAAG,EAA7B;AAEAF,EAAAA,yBAAyB,CAACG,IAA1B,GAAiCT,gCAAgC,GAAG,CAApE;AACAO,EAAAA,wBAAwB,CAACE,IAAzB,GACEH,yBAAyB,CAACG,IAA1B,GAAiCL,iBADnC;AAEAG,EAAAA,wBAAwB,CAACG,oBAAzB,GACEH,wBAAwB,CAACE,IAAzB,GAAgCN,cADlC;AAGAK,EAAAA,oBAAoB,CAACE,oBAArB,GACEH,wBAAwB,CAACG,oBAAzB,GAAgDL,UADlD;AAEAG,EAAAA,oBAAoB,CAACC,IAArB,GACED,oBAAoB,CAACE,oBAArB,GAA4CP,cAD9C;AAGA,QAAMQ,iBAAiB,GACrBH,oBAAoB,CAACC,IAArB,GAA4BH,yBAAyB,CAACG,IADxD;AAGA,SAAOE,iBAAiB,GAAGT,QAA3B;AACD","sourceRoot":"../../../src"} diff --git a/lib/commonjs/helper/coordinateConversion.js b/lib/commonjs/helper/coordinateConversion.js deleted file mode 100644 index 263895e..0000000 --- a/lib/commonjs/helper/coordinateConversion.js +++ /dev/null @@ -1,121 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.applyContainResizeMode = applyContainResizeMode; -exports.defaultTransformSubjectData = void 0; -exports.getImageOriginOnTransformSubject = getImageOriginOnTransformSubject; -exports.viewportPositionToImagePosition = viewportPositionToImagePosition; -const defaultTransformSubjectData = exports.defaultTransformSubjectData = { - offsetX: 0, - offsetY: 0, - zoomLevel: 0, - originalWidth: 0, - originalHeight: 0, - originalPageX: 0, - originalPageY: 0 -}; -/** - * Assuming you have an image that's being resized to fit into a container - * using the "contain" resize mode. You can use this function to calculate the - * size of the image after fitting. - * - * Since our sheet is resized in this manner, we need this function - * for things like pan boundaries and marker placement - * - * @param imgSize - * @param containerSize - */ - -function applyContainResizeMode(imgSize, containerSize) { - const { - width: imageWidth, - height: imageHeight - } = imgSize; - const { - width: areaWidth, - height: areaHeight - } = containerSize; - const imageAspect = imageWidth / imageHeight; - const areaAspect = areaWidth / areaHeight; - let newSize; - - if (imageAspect >= areaAspect) { - // longest edge is horizontal - newSize = { - width: areaWidth, - height: areaWidth / imageAspect - }; - } else { - // longest edge is vertical - newSize = { - width: areaHeight * imageAspect, - height: areaHeight - }; - } - - if (isNaN(newSize.height)) newSize.height = areaHeight; - if (isNaN(newSize.width)) newSize.width = areaWidth; - const scale = imageWidth ? newSize.width / imageWidth : newSize.height / imageHeight; - if (!isFinite(scale)) return { - size: null, - scale: null - }; - return { - size: newSize, - scale - }; -} -/** - * get the coord of image's origin relative to the transformSubject - * @param resizedImageSize - * @param transformSubject - */ - - -function getImageOriginOnTransformSubject(resizedImageSize, transformSubject) { - const { - offsetX, - offsetY, - zoomLevel, - originalWidth, - originalHeight - } = transformSubject; - return { - x: offsetX * zoomLevel + originalWidth / 2 - resizedImageSize.width / 2 * zoomLevel, - y: offsetY * zoomLevel + originalHeight / 2 - resizedImageSize.height / 2 * zoomLevel - }; -} -/** - * Translates the coord system of a point from the viewport's space to the image's space - * - * @param pointOnContainer - * @param sheetImageSize - * @param transformSubject - * - * @return {Vec2D} returns null if point is out of the sheet's bound - */ - - -function viewportPositionToImagePosition({ - viewportPosition, - imageSize, - zoomableEvent -}) { - const { - size: resizedImgSize, - scale: resizedImgScale - } = applyContainResizeMode(imageSize, { - width: zoomableEvent.originalWidth, - height: zoomableEvent.originalHeight - }); - if (resizedImgScale == null) return null; - const sheetOriginOnContainer = getImageOriginOnTransformSubject(resizedImgSize, zoomableEvent); - const pointOnSheet = { - x: (viewportPosition.x - sheetOriginOnContainer.x) / zoomableEvent.zoomLevel / resizedImgScale, - y: (viewportPosition.y - sheetOriginOnContainer.y) / zoomableEvent.zoomLevel / resizedImgScale - }; - return pointOnSheet; -} -//# sourceMappingURL=coordinateConversion.js.map \ No newline at end of file diff --git a/lib/commonjs/helper/coordinateConversion.js.map b/lib/commonjs/helper/coordinateConversion.js.map deleted file mode 100644 index 7ceba03..0000000 --- a/lib/commonjs/helper/coordinateConversion.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["helper/coordinateConversion.ts"],"names":["defaultTransformSubjectData","offsetX","offsetY","zoomLevel","originalWidth","originalHeight","originalPageX","originalPageY","applyContainResizeMode","imgSize","containerSize","width","imageWidth","height","imageHeight","areaWidth","areaHeight","imageAspect","areaAspect","newSize","isNaN","scale","isFinite","size","getImageOriginOnTransformSubject","resizedImageSize","transformSubject","x","y","viewportPositionToImagePosition","viewportPosition","imageSize","zoomableEvent","resizedImgSize","resizedImgScale","sheetOriginOnContainer","pointOnSheet"],"mappings":";;;;;;;;;AAEO,MAAMA,2BAA8C,yCAAG;AAC5DC,EAAAA,OAAO,EAAE,CADmD;AAE5DC,EAAAA,OAAO,EAAE,CAFmD;AAG5DC,EAAAA,SAAS,EAAE,CAHiD;AAI5DC,EAAAA,aAAa,EAAE,CAJ6C;AAK5DC,EAAAA,cAAc,EAAE,CAL4C;AAM5DC,EAAAA,aAAa,EAAE,CAN6C;AAO5DC,EAAAA,aAAa,EAAE;AAP6C,CAAvD;AAUP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,sBAAT,CACLC,OADK,EAELC,aAFK,EAG0D;AAC/D,QAAM;AAAEC,IAAAA,KAAK,EAAEC,UAAT;AAAqBC,IAAAA,MAAM,EAAEC;AAA7B,MAA6CL,OAAnD;AACA,QAAM;AAAEE,IAAAA,KAAK,EAAEI,SAAT;AAAoBF,IAAAA,MAAM,EAAEG;AAA5B,MAA2CN,aAAjD;AACA,QAAMO,WAAW,GAAGL,UAAU,GAAGE,WAAjC;AACA,QAAMI,UAAU,GAAGH,SAAS,GAAGC,UAA/B;AAEA,MAAIG,OAAJ;;AACA,MAAIF,WAAW,IAAIC,UAAnB,EAA+B;AAC7B;AACAC,IAAAA,OAAO,GAAG;AAAER,MAAAA,KAAK,EAAEI,SAAT;AAAoBF,M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ACO,SAAS0B,+BAAT,CAAyC;AAC9CC,EAAAA,gBAD8C;AAE9CC,EAAAA,SAF8C;AAG9CC,EAAAA;AAH8C,CAAzC,EAQU;AACf,QAAM;AAAET,IAAAA,IAAI,EAAEU,cAAR;AAAwBZ,IAAAA,KAAK,EAAEa;AAA/B,MACJ1B,sBAAsB,CAACuB,SAAD,EAAY;AAChCpB,IAAAA,KAAK,EAAEqB,aAAa,CAAC5B,aADW;AAEhCS,IAAAA,MAAM,EAAEmB,aAAa,CAAC3B;AAFU,GAAZ,CADxB;AAMA,MAAI6B,eAAe,IAAI,IAAvB,EAA6B,OAAO,IAAP;AAE7B,QAAMC,sBAAsB,GAAGX,gCAAgC,CAC7DS,cAD6D,EAE7DD,aAF6D,CAA/D;AAKA,QAAMI,YAAY,GAAG;AACnBT,IAAAA,CAAC,EACC,CAACG,gBAAgB,CAACH,CAAjB,GAAqBQ,sBAAsB,CAACR,CAA7C,IACAK,aAAa,CAAC7B,SADd,GAEA+B,eAJiB;AAKnBN,IAAAA,CAAC,EACC,CAACE,gBAAgB,CAACF,CAAjB,GAAqBO,sBAAsB,CAACP,CAA7C,IACAI,aAAa,CAAC7B,SADd,GAEA+B;AARiB,GAArB;AAWA,SAAOE,YAAP;AACD","sourceRoot":"../../../src"} diff --git a/lib/commonjs/helper/index.js b/lib/commonjs/helper/index.js deleted file mode 100644 index 9f2d746..0000000 --- a/lib/commonjs/helper/index.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.calcGestureCenterPoint = calcGestureCenterPoint; -exports.calcGestureTouchDistance = calcGestureTouchDistance; -Object.defineProperty(exports, "calcNewScaledOffsetForZoomCentering", { - enumerable: true, - get: function () { - return _calcNewScaledOffsetForZoomCentering.calcNewScaledOffsetForZoomCentering; - } -}); - -var _calcNewScaledOffsetForZoomCentering = require("./calcNewScaledOffsetForZoomCentering"); - -/** - * Calculates the gesture center point relative to the page coordinate system - * - * We're unable to use touch.locationX/Y - * because locationX uses the axis system of the leaf element that the touch occurs on, - * which makes it even more complicated to translate into our container's axis system. - * - * We're also unable to use gestureState.moveX/Y - * because gestureState.moveX/Y is messed up on real device - * (Sometimes it's the center point, but sometimes it randomly takes the position of one of the touches) - */ -function calcGestureCenterPoint(e, gestureState) { - const touches = e.nativeEvent.touches; - if (!touches[0]) return null; - - if (gestureState.numberActiveTouches === 2) { - if (!touches[1]) return null; - return { - x: (touches[0].pageX + touches[1].pageX) / 2, - y: (touches[0].pageY + touches[1].pageY) / 2 - }; - } - - if (gestureState.numberActiveTouches === 1) { - return { - x: touches[0].pageX, - y: touches[0].pageY - }; - } - - return null; -} - -function calcGestureTouchDistance(e, gestureState) { - const touches = e.nativeEvent.touches; - if (gestureState.numberActiveTouches !== 2 || !touches[0] || !touches[1]) return null; - const dx = Math.abs(touches[0].pageX - touches[1].pageX); - const dy = Math.abs(touches[0].pageY - touches[1].pageY); - return Math.sqrt(dx * dx + dy * dy); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/helper/index.js.map b/lib/commonjs/helper/index.js.map deleted file mode 100644 index 428053e..0000000 --- a/lib/commonjs/helper/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["helper/index.ts"],"names":["calcGestureCenterPoint","e","gestureState","touches","nativeEvent","numberActiveTouches","x","pageX","y","pageY","calcGestureTouchDistance","dx","Math","abs","dy","sqrt"],"mappings":";;;;;;;;;;;;;;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAT,CACLC,CADK,EAELC,YAFK,EAGS;AACd,QAAMC,OAAO,GAAGF,CAAC,CAACG,WAAF,CAAcD,OAA9B;AACA,MAAI,CAACA,OAAO,CAAC,CAAD,CAAZ,EAAiB,OAAO,IAAP;;AAEjB,MAAID,YAAY,CAACG,mBAAb,KAAqC,CAAzC,EAA4C;AAC1C,QAAI,CAACF,OAAO,CAAC,CAAD,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back.js deleted file mode 100644 index 3a702d3..0000000 --- a/lib/commonjs/hooks/useLatestCallback.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useLatestCallback = void 0; - -var _react = require("react"); - -/** - * A hook that returns a stable callback reference that always calls the latest version of the function. - * This avoids the need to include the callback in dependency arrays while ensuring the latest version is called. - */ -const useLatestCallback = callback => { - const ref = (0, _react.useRef)(callback); - ref.current = callback; - return (0, _react.useRef)((...args) => ref.current(...args)).current; -}; - -exports.useLatestCallback = useLatestCallback; -//# sourceMappingURL=useLatestCallback.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useLatestCallback.js.map b/lib/commonjs/hooks/useLatestCallback.js.map deleted file mode 100644 index 2c534b1..0000000 --- a/lib/commonjs/hooks/useLatestCallback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["hooks/useLatestCallback.ts"],"names":["useLatestCallback","callback","ref","current","args"],"mappings":";;;;;;;AAAA;;AAEA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,GAC5BC,QAD+B,IAE5B;AACH,QAAMC,GAAG,GAAG,mBAAOD,QAAP,CAAZ;AACAC,EAAAA,GAAG,CAACC,OAAJ,GAAcF,QAAd;AAEA,SAAO,mBAAwB,CAAC,GAAGG,IAAJ,KAAaF,GAAG,CAACC,OAAJ,CAAY,GAAGC,IAAf,CAArC,EAA2DD,OAAlE;AACD,CAPM","sourceRoot":"../../../src"} diff --git a/lib/commonjs/index.js b/lib/commonjs/index.js deleted file mode 100644 index 1356a2d..0000000 --- a/lib/commonjs/index.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "ReactNativeZoomableView", { - enumerable: true, - get: function () { - return _ReactNativeZoomableView.default; - } -}); -Object.defineProperty(exports, "applyContainResizeMode", { - enumerable: true, - get: function () { - return _coordinateConversion.applyContainResizeMode; - } -}); -Object.defineProperty(exports, "getImageOriginOnTransformSubject", { - enumerable: true, - get: function () { - return _coordinateConversion.getImageOriginOnTransformSubject; - } -}); -Object.defineProperty(exports, "viewportPositionToImagePosition", { - enumerable: true, - get: function () { - return _coordinateConversion.viewportPositionToImagePosition; - } -}); - -var _coordinateConversion = require("./helper/coordinateConversion"); - -var _ReactNativeZoomableView = _interopRequireDefault(require("./ReactNativeZoomableView")); - -function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/index.js.map b/lib/commonjs/index.js.map deleted file mode 100644 index 8b09dc9..0000000 --- a/lib/commonjs/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAKA","sourceRoot":"../../src"} diff --git a/lib/commonjs/package.json b/lib/commonjs/package.json deleted file mode 100644 index 729ac4d..0000000 --- a/lib/commonjs/package.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"commonjs"} diff --git a/lib/commonjs/typings/index.js b/lib/commonjs/typings/index.js deleted file mode 100644 index fe4e49b..0000000 --- a/lib/commonjs/typings/index.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.SwipeDirection = void 0; - -let SwipeDirection = exports.SwipeDirection = /*#__PURE__*/function (SwipeDirection) { - SwipeDirection["SWIPE_UP"] = "SWIPE_UP"; - SwipeDirection["SWIPE_DOWN"] = "SWIPE_DOWN"; - SwipeDirection["SWIPE_LEFT"] = "SWIPE_LEFT"; - SwipeDirection["SWIPE_RIGHT"] = "SWIPE_RIGHT"; - return SwipeDirection; -}({}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/typings/index.js.map b/lib/commonjs/typings/index.js.map deleted file mode 100644 index 7227b94..0000000 --- a/lib/commonjs/typings/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["typings/index.ts"],"names":["SwipeDirection"],"mappings":";;;;;;;IASYA,c,mDAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;SAAAA,c","sourceRoot":"../../../src"} diff --git a/lib/module/ReactNativeZoomableView.js b/lib/module/ReactNativeZoomableView.js deleted file mode 100644 index b399085..0000000 --- a/lib/module/ReactNativeZoomableView.js +++ /dev/null @@ -1,1035 +0,0 @@ -"use strict"; - -import { debounce } from 'lodash'; -import React, { Component, createRef } from 'react'; -import { Animated, PanResponder, StyleSheet, View } from 'react-native'; -import { getZoomToAnimation } from './animations'; -import { AnimatedTouchFeedback } from './components'; -import { StaticPin } from './components/StaticPin'; -import { DebugTouchPoint } from './debugHelper'; -import { calcGestureCenterPoint, calcGestureTouchDistance, calcNewScaledOffsetForZoomCentering } from './helper'; -import { viewportPositionToImagePosition } from './helper/coordinateConversion'; -import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; -const initialState = { - originalWidth: 0, - originalHeight: 0, - originalPageX: 0, - originalPageY: 0, - originalX: 0, - originalY: 0, - pinSize: { - width: 0, - height: 0 - } -}; - -class ReactNativeZoomableView extends Component { - static defaultProps = { - zoomEnabled: true, - panEnabled: true, - initialZoom: 1, - initialOffsetX: 0, - initialOffsetY: 0, - maxZoom: 1.5, - minZoom: 0.5, - pinchToZoomInSensitivity: 1, - pinchToZoomOutSensitivity: 1, - movementSensibility: 1, - doubleTapDelay: 300, - zoomStep: 0.5, - onLongPress: null, - longPressDuration: 700, - contentWidth: undefined, - contentHeight: undefined, - visualTouchFeedbackEnabled: true, - staticPinPosition: undefined, - staticPinIcon: undefined, - onStaticPinPositionChange: undefined, - onStaticPinPositionMove: undefined, - disablePanOnInitialZoom: false - }; - panAnim = new Animated.ValueXY({ - x: 0, - y: 0 - }); - zoomAnim = new Animated.Value(1); - offsetX = 0; - offsetY = 0; - zoomLevel = 1; - lastGestureCenterPosition = null; - lastGestureTouchDistance = null; - _gestureStarted = false; - - set gestureStarted(v) { - this._gestureStarted = v; - } - - get gestureStarted() { - return this._gestureStarted; - } - /** - * Last press time (used to evaluate whether user double tapped) - * @type {number} - */ - - - longPressTimeout = null; - touches = []; - - constructor(props) { - super(props); // This needs to be done before anything else to initialize the state. - // Otherwise, the logic below may reference the state when it's undefined, - // causing runtime errors. - - this.state = { ...initialState - }; - this.gestureHandlers = PanResponder.create({ - onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder, - onPanResponderGrant: this._handlePanResponderGrant, - onPanResponderMove: this._handlePanResponderMove, - onPanResponderRelease: this._handlePanResponderEnd, - onPanResponderTerminate: (evt, gestureState) => { - // We should also call _handlePanResponderEnd - // to properly perform cleanups when the gesture is terminated - // (aka gesture handling responsibility is taken over by another component). - // This also fixes a weird issue where - // on real device, sometimes onPanResponderRelease is not called when you lift 2 fingers up, - // but onPanResponderTerminate is called instead for no apparent reason. - this._handlePanResponderEnd(evt, gestureState); - - this.props.onPanResponderTerminate?.(evt, gestureState, this._getZoomableViewEventObject()); - }, - onPanResponderTerminationRequest: (evt, gestureState) => !!this.props.onPanResponderTerminationRequest?.(evt, gestureState, this._getZoomableViewEventObject()), - // Defaults to true to prevent parent components, such as React Navigation's tab view, from taking over as responder. - onShouldBlockNativeResponder: (evt, gestureState) => this.props.onShouldBlockNativeResponder?.(evt, gestureState, this._getZoomableViewEventObject()) ?? true, - onStartShouldSetPanResponderCapture: (evt, gestureState) => !!this.props.onStartShouldSetPanResponderCapture?.(evt, gestureState), - onMoveShouldSetPanResponderCapture: (evt, gestureState) => !!this.props.onMoveShouldSetPanResponderCapture?.(evt, gestureState) - }); - this.zoomSubjectWrapperRef = /*#__PURE__*/createRef(); - if (this.props.zoomAnimatedValue) this.zoomAnim = this.props.zoomAnimatedValue; - if (this.props.panAnimatedValueXY) this.panAnim = this.props.panAnimatedValueXY; - if (this.props.initialZoom) this.zoomLevel = this.props.initialZoom; - if (this.props.initialOffsetX != null) this.offsetX = this.props.initialOffsetX; - if (this.props.initialOffsetY != null) this.offsetY = this.props.initialOffsetY; - this.panAnim.setValue({ - x: this.offsetX, - y: this.offsetY - }); - this.zoomAnim.setValue(this.zoomLevel); - this.panAnim.addListener(({ - x, - y - }) => { - this.offsetX = x; - this.offsetY = y; - }); - this.zoomAnim.addListener(({ - value - }) => { - this.zoomLevel = value; - }); - this.lastGestureTouchDistance = 150; - this.gestureType = null; - } - - componentDidUpdate(prevProps, prevState) { - const { - zoomEnabled, - initialZoom - } = this.props; - - if (prevProps.zoomEnabled && !zoomEnabled && initialZoom) { - this.zoomLevel = initialZoom; - this.zoomAnim.setValue(this.zoomLevel); - } - - if (!this.onTransformInvocationInitialized && this._invokeOnTransform().successful) { - this.panAnim.addListener(() => this._invokeOnTransform()); - this.zoomAnim.addListener(() => this._invokeOnTransform()); - this.onTransformInvocationInitialized = true; - } - - const currState = this.state; - const originalMeasurementsChanged = currState.originalHeight !== prevState.originalHeight || currState.originalWidth !== prevState.originalWidth || currState.originalPageX !== prevState.originalPageX || currState.originalPageY !== prevState.originalPageY || currState.originalX !== prevState.originalX || currState.originalY !== prevState.originalY; - const staticPinPositionChanged = prevProps.staticPinPosition?.x !== this.props.staticPinPosition?.x || prevProps.staticPinPosition?.y !== this.props.staticPinPosition?.y; // We use a custom `onLayout` event, so the clients can stay in-sync - // with when the internal measurements are actually saved to the state, - // thus helping them apply transformations at more accurate timings - - if (originalMeasurementsChanged) { - const layout = { - width: currState.originalWidth, - height: currState.originalHeight, - x: currState.originalX, - y: currState.originalY - }; - this.props.onLayout?.({ - nativeEvent: { - layout - } - }); - } - - if (this.onTransformInvocationInitialized && (originalMeasurementsChanged || staticPinPositionChanged)) { - this._invokeOnTransform(); - } - } - - componentDidMount() { - this.measureZoomSubject(); // We've already run `grabZoomSubjectOriginalMeasurements` at various events - // to make sure the measurements are promptly updated. - // However, there might be cases we haven't accounted for, especially when - // native processes are involved. To account for those cases, - // we'll use an interval here to ensure we're always up-to-date. - // The `setState` in `grabZoomSubjectOriginalMeasurements` won't trigger a rerender - // if the values given haven't changed, so we're not running performance risk here. - - this.measureZoomSubjectInterval = setInterval(this.measureZoomSubject, 1e3); - } - - componentWillUnmount() { - this.measureZoomSubjectInterval && clearInterval(this.measureZoomSubjectInterval); - } - - debouncedOnStaticPinPositionChange = debounce(position => this.props.onStaticPinPositionChange?.(position), 100); - /** - * try to invoke onTransform - * @private - */ - - _invokeOnTransform() { - const zoomableViewEvent = this._getZoomableViewEventObject(); - - const position = this._staticPinPosition(); - - if (!zoomableViewEvent.originalWidth || !zoomableViewEvent.originalHeight) return { - successful: false - }; - this.props.onTransform?.(zoomableViewEvent); - - if (position) { - this.props.onStaticPinPositionMove?.(position); - this.debouncedOnStaticPinPositionChange(position); - } - - return { - successful: true - }; - } - /** - * Returns additional information about components current state for external event hooks - * - * @returns {{}} - * @private - */ - - - _getZoomableViewEventObject(overwriteObj = {}) { - return { - zoomLevel: this.zoomLevel, - offsetX: this.offsetX, - offsetY: this.offsetY, - originalHeight: this.state.originalHeight, - originalWidth: this.state.originalWidth, - originalPageX: this.state.originalPageX, - originalPageY: this.state.originalPageY, - ...overwriteObj - }; - } - /** - * Get the original box dimensions and save them for later use. - * (They will be used to calculate boxBorders) - * - * @private - */ - - - measureZoomSubject = () => { - // make sure we measure after animations are complete - requestAnimationFrame(() => { - // this setTimeout is here to fix a weird issue on iOS where the measurements are all `0` - // when navigating back (react-navigation stack) from another view - // while closing the keyboard at the same time - setTimeout(() => { - // In normal conditions, we're supposed to measure zoomSubject instead of its wrapper. - // However, our zoomSubject may have been transformed by an initial zoomLevel or offset, - // in which case these measurements will not represent the true "original" measurements. - // We just need to make sure the zoomSubjectWrapper perfectly aligns with the zoomSubject - // (no border, space, or anything between them) - this.zoomSubjectWrapperRef.current?.measure((x, y, width, height, pageX, pageY) => { - // When the component is off-screen, these become all 0s, so we don't set them - // to avoid messing up calculations, especially ones that are done right after - // the component transitions from hidden to visible. - if (!pageX && !pageY && !width && !height) return; // If these values are all the same, don't re-set them in state - // this way we don't re-render - - if (this.state.originalX === x && this.state.originalY === y && this.state.originalWidth === width && this.state.originalHeight === height && this.state.originalPageX === pageX && this.state.originalPageY === pageY) { - return; - } - - this.setState({ - originalX: x, - originalY: y, - originalWidth: width, - originalHeight: height, - originalPageX: pageX, - originalPageY: pageY - }); - }); - }); - }); - }; - /** - * Handles the start of touch events and checks for taps - * - * @param e - * @param gestureState - * @returns {boolean} - * - * @private - */ - - _handleStartShouldSetPanResponder = (e, gestureState) => { - if (this.props.onStartShouldSetPanResponder) { - this.props.onStartShouldSetPanResponder(e, gestureState, this._getZoomableViewEventObject(), false); - } // Always set pan responder on start - // of gesture so we can handle tap. - // "Pan threshold validation" will be handled - // in `onPanResponderMove` instead of in `onMoveShouldSetPanResponder` - - - return true; - }; - /** - * Calculates pinch distance - * - * @param e - * @param gestureState - * @private - */ - - _handlePanResponderGrant = (e, gestureState) => { - if (this.props.onLongPress) { - e.persist(); - this.longPressTimeout = setTimeout(() => { - this.props.onLongPress?.(e, gestureState, this._getZoomableViewEventObject()); - this.longPressTimeout = null; - }, this.props.longPressDuration); - } - - this.props.onPanResponderGrant?.(e, gestureState, this._getZoomableViewEventObject()); - this.panAnim.stopAnimation(); - this.zoomAnim.stopAnimation(); - this.gestureStarted = true; - }; - /** - * Handles the end of touch events - * - * @param e - * @param gestureState - * - * @private - */ - - _handlePanResponderEnd = (e, gestureState) => { - if (!this.gestureType) { - this._resolveAndHandleTap(e); - } - - this.setState({ - debugPoints: [] - }); - this.lastGestureCenterPosition = null; - - if (this.longPressTimeout) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } - - this.props.onPanResponderEnd?.(e, gestureState, this._getZoomableViewEventObject()); - - if (this.gestureType === 'pinch') { - this.props.onZoomEnd?.(e, gestureState, this._getZoomableViewEventObject()); - } else if (this.gestureType === 'shift') { - this.props.onShiftingEnd?.(e, gestureState, this._getZoomableViewEventObject()); - } - - if (this.props.staticPinPosition) { - this._updateStaticPin(); - } - - this.gestureType = null; - this.gestureStarted = false; - }; - /** - * Handles the actual movement of our pan responder - * - * @param e - * @param gestureState - * - * @private - */ - - _handlePanResponderMove = (e, gestureState) => { - if (this.props.onPanResponderMove) { - if (this.props.onPanResponderMove(e, gestureState, this._getZoomableViewEventObject())) { - return false; - } - } // Only supports 2 touches and below, - // any invalid number will cause the gesture to end. - - - if (gestureState.numberActiveTouches <= 2) { - if (!this.gestureStarted) { - this._handlePanResponderGrant(e, gestureState); - } - } else { - if (this.gestureStarted) { - this._handlePanResponderEnd(e, gestureState); - } - - return true; - } - - if (gestureState.numberActiveTouches === 2) { - if (this.longPressTimeout) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } // change some measurement states when switching gesture to ensure a smooth transition - - - if (this.gestureType !== 'pinch') { - this.lastGestureCenterPosition = calcGestureCenterPoint(e, gestureState); - this.lastGestureTouchDistance = calcGestureTouchDistance(e, gestureState); - } - - this.gestureType = 'pinch'; - - this._handlePinching(e, gestureState); - } else if (gestureState.numberActiveTouches === 1) { - if (this.longPressTimeout && (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5)) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } // change some measurement states when switching gesture to ensure a smooth transition - - - if (this.gestureType !== 'shift') { - this.lastGestureCenterPosition = calcGestureCenterPoint(e, gestureState); - } - - const { - dx, - dy - } = gestureState; - const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2; - - if (isShiftGesture) { - this.gestureType = 'shift'; - - this._handleShifting(gestureState); - } - } - }; - /** - * Handles the pinch movement and zooming - * - * @param e - * @param gestureState - * - * @private - */ - - _handlePinching(e, gestureState) { - if (!this.props.zoomEnabled) return; - const { - maxZoom, - minZoom, - pinchToZoomInSensitivity, - pinchToZoomOutSensitivity - } = this.props; - const distance = calcGestureTouchDistance(e, gestureState); - - if (this.props.onZoomBefore && this.props.onZoomBefore(e, gestureState, this._getZoomableViewEventObject())) { - return; - } - - if (!distance) return; - if (!this.lastGestureTouchDistance) return; // define the new zoom level and take zoom level sensitivity into consideration - - const zoomGrowthFromLastGestureState = distance / this.lastGestureTouchDistance; - this.lastGestureTouchDistance = distance; - const pinchToZoomSensitivity = zoomGrowthFromLastGestureState < 1 ? pinchToZoomOutSensitivity : pinchToZoomInSensitivity; - if (pinchToZoomSensitivity == null) return; - const deltaGrowth = zoomGrowthFromLastGestureState - 1; // 0 - no resistance - // 10 - 90% resistance - - const deltaGrowthAdjustedBySensitivity = deltaGrowth * (1 - pinchToZoomSensitivity * 9 / 100); - let newZoomLevel = this.zoomLevel * (1 + deltaGrowthAdjustedBySensitivity); // make sure max and min zoom levels are respected - - if (maxZoom != null && newZoomLevel > maxZoom) { - newZoomLevel = maxZoom; - } - - if (minZoom != null && newZoomLevel < minZoom) { - newZoomLevel = minZoom; - } - - const gestureCenterPoint = calcGestureCenterPoint(e, gestureState); - if (!gestureCenterPoint) return; - let zoomCenter = { - x: gestureCenterPoint.x - this.state.originalPageX, - y: gestureCenterPoint.y - this.state.originalPageY - }; - - if (this.props.staticPinPosition) { - // When we use a static pin position, the zoom centre is the same as that position, - // otherwise the pin moves around way too much while zooming. - zoomCenter = { - x: this.props.staticPinPosition.x, - y: this.props.staticPinPosition.y - }; - } // Uncomment to debug - - - this.props.debug && this._setPinchDebugPoints(e, zoomCenter); - const { - originalHeight, - originalWidth - } = this.state; - const oldOffsetX = this.offsetX; - const oldOffsetY = this.offsetY; - const oldScale = this.zoomLevel; - const newScale = newZoomLevel; - if (!originalHeight || !originalWidth) return; - let offsetY = calcNewScaledOffsetForZoomCentering(oldOffsetY, originalHeight, oldScale, newScale, zoomCenter.y); - let offsetX = calcNewScaledOffsetForZoomCentering(oldOffsetX, originalWidth, oldScale, newScale, zoomCenter.x); - - const offsetShift = this._calcOffsetShiftSinceLastGestureState(gestureCenterPoint); - - if (offsetShift) { - offsetX += offsetShift.x; - offsetY += offsetShift.y; - } - - this.offsetX = offsetX; - this.offsetY = offsetY; - this.zoomLevel = newScale; - this.panAnim.setValue({ - x: this.offsetX, - y: this.offsetY - }); - this.zoomAnim.setValue(this.zoomLevel); - this.props.onZoomAfter?.(e, gestureState, this._getZoomableViewEventObject()); - } - /** - * Used to debug pinch events - * @param gestureResponderEvent - * @param zoomCenter - * @param points - */ - - - _setPinchDebugPoints(gestureResponderEvent, zoomCenter, ...points) { - const { - touches - } = gestureResponderEvent.nativeEvent; - const { - originalPageY, - originalPageX - } = this.state; - this.setState({ - debugPoints: [{ - x: touches[0].pageX - originalPageX, - y: touches[0].pageY - originalPageY - }, { - x: touches[1].pageX - originalPageX, - y: touches[1].pageY - originalPageY - }, zoomCenter, ...points] - }); - } - /** - * Calculates the amount the offset should shift since the last position during panning - * - * @param {Vec2D} gestureCenterPoint - * - * @private - */ - - - _calcOffsetShiftSinceLastGestureState(gestureCenterPoint) { - const { - movementSensibility - } = this.props; - let shift = null; - - if (this.lastGestureCenterPosition && movementSensibility) { - const dx = gestureCenterPoint.x - this.lastGestureCenterPosition.x; - const dy = gestureCenterPoint.y - this.lastGestureCenterPosition.y; - const shiftX = dx / this.zoomLevel / movementSensibility; - const shiftY = dy / this.zoomLevel / movementSensibility; - shift = { - x: shiftX, - y: shiftY - }; - } - - this.lastGestureCenterPosition = gestureCenterPoint; - return shift; - } - /** - * Handles movement by tap and move - * - * @param gestureState - * - * @private - */ - - - _handleShifting(gestureState) { - // Skips shifting if panEnabled is false or disablePanOnInitialZoom is true and we're on the initial zoom level - if (!this.props.panEnabled || this.props.disablePanOnInitialZoom && this.zoomLevel === this.props.initialZoom) { - return; - } - - const shift = this._calcOffsetShiftSinceLastGestureState({ - x: gestureState.moveX, - y: gestureState.moveY - }); - - if (!shift) return; - const offsetX = this.offsetX + shift.x; - const offsetY = this.offsetY + shift.y; - - if (this.props.debug && this.state.originalPageX && this.state.originalPageY) { - const x = gestureState.moveX - this.state.originalPageX; - const y = gestureState.moveY - this.state.originalPageY; - this.setState({ - debugPoints: [{ - x, - y - }] - }); - } - - this._setNewOffsetPosition(offsetX, offsetY); - } - /** - * Set the state to offset moved - * - * @param {number} newOffsetX - * @param {number} newOffsetY - * @returns - */ - - - _setNewOffsetPosition(newOffsetX, newOffsetY) { - const { - onShiftingBefore, - onShiftingAfter - } = this.props; - - if (onShiftingBefore?.(null, null, this._getZoomableViewEventObject())) { - return; - } - - this.offsetX = newOffsetX; - this.offsetY = newOffsetY; - this.panAnim.setValue({ - x: this.offsetX, - y: this.offsetY - }); - this.zoomAnim.setValue(this.zoomLevel); - onShiftingAfter?.(null, null, this._getZoomableViewEventObject()); - } - /** - * Check whether the press event is double tap - * or single tap and handle the event accordingly - * - * @param e - * - * @private - */ - - - _resolveAndHandleTap = e => { - const now = Date.now(); - - if (this.doubleTapFirstTapReleaseTimestamp && this.props.doubleTapDelay && now - this.doubleTapFirstTapReleaseTimestamp < this.props.doubleTapDelay) { - this.doubleTapFirstTap && this._addTouch({ ...this.doubleTapFirstTap, - id: now.toString(), - isSecondTap: true - }); - this.singleTapTimeoutId && clearTimeout(this.singleTapTimeoutId); - delete this.doubleTapFirstTapReleaseTimestamp; - delete this.singleTapTimeoutId; - delete this.doubleTapFirstTap; - - this._handleDoubleTap(e); - } else { - this.doubleTapFirstTapReleaseTimestamp = now; - this.doubleTapFirstTap = { - id: now.toString(), - x: e.nativeEvent.pageX - this.state.originalPageX, - y: e.nativeEvent.pageY - this.state.originalPageY - }; - - this._addTouch(this.doubleTapFirstTap); // persist event so e.nativeEvent is preserved after a timeout delay - - - e.persist(); - this.singleTapTimeoutId = setTimeout(() => { - delete this.doubleTapFirstTapReleaseTimestamp; - delete this.singleTapTimeoutId; // Pan to the tapped location - - if (this.props.staticPinPosition && this.doubleTapFirstTap) { - const tapX = this.props.staticPinPosition.x - this.doubleTapFirstTap.x; - const tapY = this.props.staticPinPosition.y - this.doubleTapFirstTap.y; - Animated.timing(this.panAnim, { - toValue: { - x: this.offsetX + tapX / this.zoomLevel, - y: this.offsetY + tapY / this.zoomLevel - }, - useNativeDriver: true, - duration: 200 - }).start(() => { - this._updateStaticPin(); - }); - } - - this.props.onSingleTap?.(e, this._getZoomableViewEventObject()); - }, this.props.doubleTapDelay); - } - }; - moveStaticPinTo = (position, duration) => { - const { - originalWidth, - originalHeight - } = this.state; - const { - staticPinPosition, - contentWidth, - contentHeight - } = this.props; - if (!staticPinPosition) return; - if (!originalWidth || !originalHeight) return; - if (!contentWidth || !contentHeight) return; // Offset for the static pin - - const pinX = staticPinPosition.x - originalWidth / 2; - const pinY = staticPinPosition.y - originalHeight / 2; - this.offsetX = contentWidth / 2 - position.x + pinX / this.zoomLevel; - this.offsetY = contentHeight / 2 - position.y + pinY / this.zoomLevel; - - if (duration) { - Animated.timing(this.panAnim, { - toValue: { - x: this.offsetX, - y: this.offsetY - }, - useNativeDriver: true, - duration - }).start(); - } else { - this.panAnim.setValue({ - x: this.offsetX, - y: this.offsetY - }); - } - }; - _staticPinPosition = () => { - if (!this.props.staticPinPosition) return; - if (!this.props.contentWidth || !this.props.contentHeight) return; - return viewportPositionToImagePosition({ - viewportPosition: { - x: this.props.staticPinPosition.x, - y: this.props.staticPinPosition.y - }, - imageSize: { - height: this.props.contentHeight, - width: this.props.contentWidth - }, - zoomableEvent: { ...this._getZoomableViewEventObject(), - offsetX: this.offsetX, - offsetY: this.offsetY, - zoomLevel: this.zoomLevel - } - }); - }; - _updateStaticPin = () => { - const position = this._staticPinPosition(); - - if (!position) return; - this.props.onStaticPinPositionChange?.(position); - }; - - _addTouch(touch) { - this.touches.push(touch); - this.setState({ - touches: [...this.touches] - }); - } - - _removeTouch(touch) { - this.touches.splice(this.touches.indexOf(touch), 1); - this.setState({ - touches: [...this.touches] - }); - } - /** - * Handles the double tap event - * - * @param e - * - * @private - */ - - - _handleDoubleTap(e) { - const { - onDoubleTapBefore, - onDoubleTapAfter, - doubleTapZoomToCenter - } = this.props; - onDoubleTapBefore?.(e, this._getZoomableViewEventObject()); - - const nextZoomStep = this._getNextZoomStep(); - - if (nextZoomStep == null) return; - const { - originalPageX, - originalPageY - } = this.state; // define new zoom position coordinates - - const zoomPositionCoordinates = { - x: e.nativeEvent.pageX - originalPageX, - y: e.nativeEvent.pageY - originalPageY - }; // if doubleTapZoomToCenter enabled -> always zoom to center instead - - if (doubleTapZoomToCenter) { - zoomPositionCoordinates.x = 0; - zoomPositionCoordinates.y = 0; - } - - this.zoomTo(nextZoomStep, zoomPositionCoordinates); - onDoubleTapAfter?.(e, this._getZoomableViewEventObject({ - zoomLevel: nextZoomStep - })); - } - /** - * Returns the next zoom step based on current step and zoomStep property. - * If we are zoomed all the way in -> return to initialzoom - * - * @returns {*} - */ - - - _getNextZoomStep() { - const { - zoomStep, - maxZoom, - initialZoom - } = this.props; - const { - zoomLevel - } = this; - if (maxZoom == null) return; - - if (zoomLevel.toFixed(2) === maxZoom.toFixed(2)) { - return initialZoom; - } - - if (zoomStep == null) return; - const nextZoomStep = zoomLevel * (1 + zoomStep); - - if (nextZoomStep > maxZoom) { - return maxZoom; - } - - return nextZoomStep; - } - /** - * Zooms to a specific level. A "zoom center" can be provided, which specifies - * the point that will remain in the same position on the screen after the zoom. - * The coordinates of the zoom center is relative to the zoom subject. - * { x: 0, y: 0 } is the very center of the zoom subject. - * - * @param newZoomLevel - * @param zoomCenter - If not supplied, the container's center is the zoom center - */ - - - zoomTo(newZoomLevel, zoomCenter) { - if (!this.props.zoomEnabled) return false; - if (this.props.maxZoom && newZoomLevel > this.props.maxZoom) return false; - if (this.props.minZoom && newZoomLevel < this.props.minZoom) return false; - this.props.onZoomBefore?.(null, null, this._getZoomableViewEventObject()); // == Perform Pan Animation to preserve the zoom center while zooming == - - let listenerId = ''; - - if (zoomCenter) { - // Calculates panAnim values based on changes in zoomAnim. - let prevScale = this.zoomLevel; // Since zoomAnim is calculated in native driver, - // it will jitter panAnim once in a while, - // because here panAnim is being calculated in js. - // However the jittering should mostly occur in simulator. - - listenerId = this.zoomAnim.addListener(({ - value: newScale - }) => { - this.panAnim.setValue({ - x: calcNewScaledOffsetForZoomCentering(this.offsetX, this.state.originalWidth, prevScale, newScale, zoomCenter.x), - y: calcNewScaledOffsetForZoomCentering(this.offsetY, this.state.originalHeight, prevScale, newScale, zoomCenter.y) - }); - prevScale = newScale; - }); - } // == Perform Zoom Animation == - - - getZoomToAnimation(this.zoomAnim, newZoomLevel).start(() => { - this.zoomAnim.removeListener(listenerId); - }); // == Zoom Animation Ends == - - this.props.onZoomAfter?.(null, null, this._getZoomableViewEventObject()); - return true; - } - /** - * Zooms in or out by a specified change level - * Use a positive number for `zoomLevelChange` to zoom in - * Use a negative number for `zoomLevelChange` to zoom out - * - * Returns a promise if everything was updated and a boolean, whether it could be updated or if it exceeded the min/max zoom limits. - * - * @param {number | null} zoomLevelChange - * - * @return {bool} - */ - - - zoomBy(zoomLevelChange) { - // if no zoom level Change given -> just use zoom step - zoomLevelChange ||= this.props.zoomStep || 0; - return this.zoomTo(this.zoomLevel + zoomLevelChange); - } - /** - * Moves the zoomed view to a specified position - * Returns a promise when finished - * - * @param {number} newOffsetX the new position we want to move it to (x-axis) - * @param {number} newOffsetY the new position we want to move it to (y-axis) - * - * @return {bool} - */ - - - moveTo(newOffsetX, newOffsetY) { - const { - originalWidth, - originalHeight - } = this.state; - if (!originalWidth || !originalHeight) return; - const offsetX = (newOffsetX - originalWidth / 2) / this.zoomLevel; - const offsetY = (newOffsetY - originalHeight / 2) / this.zoomLevel; - - this._setNewOffsetPosition(-offsetX, -offsetY); - } - /** - * Moves the zoomed view by a certain amount. - * - * Returns a promise when finished - * - * @param {number} offsetChangeX the amount we want to move the offset by (x-axis) - * @param {number} offsetChangeY the amount we want to move the offset by (y-axis) - * - * @return {bool} - */ - - - moveBy(offsetChangeX, offsetChangeY) { - const offsetX = (this.offsetX * this.zoomLevel - offsetChangeX) / this.zoomLevel; - const offsetY = (this.offsetY * this.zoomLevel - offsetChangeY) / this.zoomLevel; - - this._setNewOffsetPosition(offsetX, offsetY); - } - - render() { - const { - staticPinIcon, - children, - visualTouchFeedbackEnabled, - doubleTapDelay, - staticPinPosition, - onStaticPinLongPress, - onStaticPinPress, - pinProps - } = this.props; - const { - pinSize, - touches, - debugPoints = [] - } = this.state; - return /*#__PURE__*/_jsxs(View, { - style: styles.container, - ...this.gestureHandlers.panHandlers, - ref: this.zoomSubjectWrapperRef, - onLayout: this.measureZoomSubject, - children: [/*#__PURE__*/_jsx(Animated.View, { - style: [styles.zoomSubject, this.props.style, { - transform: [// In RN79, we need to split the scale into X and Y to avoid - // the content getting pixelated when zooming in - { - scaleX: this.zoomAnim - }, { - scaleY: this.zoomAnim - }, ...this.panAnim.getTranslateTransform()] - }], - children: children - }), visualTouchFeedbackEnabled && touches?.map(touch => doubleTapDelay && /*#__PURE__*/_jsx(AnimatedTouchFeedback, { - x: touch.x, - y: touch.y, - animationDuration: doubleTapDelay, - onAnimationDone: () => { - this._removeTouch(touch); - } - }, touch.id)), debugPoints.map(({ - x, - y - }, index) => { - return /*#__PURE__*/_jsx(DebugTouchPoint, { - x: x, - y: y - }, index); - }), staticPinPosition && /*#__PURE__*/_jsx(StaticPin, { - staticPinIcon: staticPinIcon, - staticPinPosition: staticPinPosition, - pinSize: pinSize, - onPress: onStaticPinPress, - onLongPress: onStaticPinLongPress, - onParentMove: this._handlePanResponderMove, - setPinSize: size => { - this.setState({ - pinSize: size - }); - }, - pinProps: pinProps - })] - }); - } - -} - -const styles = StyleSheet.create({ - container: { - alignItems: 'center', - flex: 1, - justifyContent: 'center', - overflow: 'hidden', - position: 'relative' - }, - zoomSubject: { - alignItems: 'center', - flex: 1, - justifyContent: 'center', - width: '100%' - } -}); -export default ReactNativeZoomableView; -export { ReactNativeZoomableView }; -//# sourceMappingURL=ReactNativeZoomableView.js.map \ No newline at end of file diff --git a/lib/module/ReactNativeZoomableView.js.map b/lib/module/ReactNativeZoomableView.js.map deleted file mode 100644 index 1af51cb..0000000 --- a/lib/module/ReactNativeZoomableView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["ReactNativeZoomableView.tsx"],"names":["debounce","React","Component","createRef","Animated","PanResponder","StyleSheet","View","getZoomToAnimation","AnimatedTouchFeedback","StaticPin","DebugTouchPoint","calcGestureCenterPoint","calcGestureTouchDistance","calcNewScaledOffsetForZoomCentering","viewportPositionToImagePosition","initialState","originalWidth","originalHeight","originalPageX","originalPageY","originalX","originalY","pinSize","width","height","ReactNativeZoomableView","defaultProps","zoomEnabled","panEnabled","initialZoom","initialOffsetX","initialOffsetY","maxZoom","minZoom","pinchToZoomInSensitivity","pinchToZoomOutSensitivity","movementSensibility","doubleTapDelay","zoomStep","onLongPress","longPressDuration","contentWidth","undefined","contentHeight","visualTouchFeedbackEnabled","staticPinPosition","staticPinIcon","onStaticPinPositionChange","onStaticPinPositionMove","disablePanOnInitialZoom","panAnim","ValueXY","x","y","zoomAnim","Value","offsetX","offsetY","zoomLevel","lastGestureCenterPosition","lastGestureTouchDistance","_gestureStarted","gestureStarted","v","longPressTimeout","touches","constructor","props","state","gestureHandlers","create","onStartShouldSetPanResponder","_handleStartShouldSetPanResponder","onPanResponderGrant","_handlePanResponderGrant","onPanResponderMove","_handlePanResponderMove","onPanResponderRelease","_handlePanResponderEnd","onPanResponderTerminate","evt","gestureState","_getZoomableViewEventObject","onPanResponderTerminationRequest","onShouldBlockNativeResponder","onStartShouldSetPanResponderCapture","onMoveShouldSetPanResponderCapture","zoomSubjectWrapperRef","zoomAnimatedValue","panAnimatedValueXY","setValue","addListener","value","gestureType","componentDidUpdate","prevProps","prevState","onTransformInvocationInitialized","_invokeOnTransform","successful","currState","originalMeasurementsChanged","staticPinPositionChanged","layout","onLayout","nativeEvent","componentDidMount","measureZoomSubject","measureZoomSubjectInterval","setInterval","componentWillUnmount","clearInterval","debouncedOnStaticPinPositionChange","position","zoomableViewEvent","_staticPinPosition","onTransform","overwriteObj","requestAnimationFrame","setTimeout","current","measure","pageX","pageY","setState","e","persist","stopAnimation","_resolveAndHandleTap","debugPoints","clearTimeout","onPanResponderEnd","onZoomEnd","onShiftingEnd","_updateStaticPin","numberActiveTouches","_handlePinching","Math","abs","dx","dy","isShiftGesture","_handleShifting","distance","onZoomBefore","zoomGrowthFromLastGestureState","pinchToZoomSensitivity","deltaGrowth","deltaGrowthAdjustedBySensitivity","newZoomLevel","gestureCenterPoint","zoomCenter","debug","_setPinchDebugPoints","oldOffsetX","oldOffsetY","oldScale","newScale","offsetShift","_calcOffsetShiftSinceLastGestureState","onZoomAfter","gestureResponderEvent","points","shift","shiftX","shiftY","moveX","moveY","_setNewOffsetPosition","newOffsetX","newOffsetY","onShiftingBefore","onShiftingAfter","now","Date","doubleTapFirstTapReleaseTimestamp","doubleTapFirstTap","_addTouch","id","toString","isSecondTap","singleTapTimeoutId","_handleDoubleTap","tapX","tapY","timing","toValue","useNativeDriver","duration","start","onSingleTap","moveStaticPinTo","pinX","pinY","viewportPosition","imageSize","zoomableEvent","touch","push","_removeTouch","splice","indexOf","onDoubleTapBefore","onDoubleTapAfter","doubleTapZoomToCenter","nextZoomStep","_getNextZoomStep","zoomPositionCoordinates","zoomTo","toFixed","listenerId","prevScale","removeListener","zoomBy","zoomLevelChange","moveTo","moveBy","offsetChangeX","offsetChangeY","render","children","onStaticPinLongPress","onStaticPinPress","pinProps","styles","container","panHandlers","zoomSubject","style","transform","scaleX","scaleY","getTranslateTransform","map","index","size","alignItems","flex","justifyContent","overflow"],"mappings":";;AAAA,SAASA,QAAT,QAAyB,QAAzB;AACA,OAAOC,KAAP,IAAgBC,SAAhB,EAA2BC,SAA3B,QAAuD,OAAvD;AACA,SACEC,QADF,EAGEC,YAHF,EAOEC,UAPF,EAQEC,IARF,QASO,cATP;AAWA,SAASC,kBAAT,QAAmC,cAAnC;AACA,SAASC,qBAAT,QAAsC,cAAtC;AACA,SAASC,SAAT,QAA0B,wBAA1B;AACA,SAASC,eAAT,QAAgC,eAAhC;AACA,SACEC,sBADF,EAEEC,wBAFF,EAGEC,mCAHF,QAIO,UAJP;AAKA,SAASC,+BAAT,QAAgD,+BAAhD;;AAU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qB;AACpC,4BAAO,KAAC,eAAD;AAA6B,UAAA,CAAC,EAAEtL,CAAhC;AAAmC,UAAA,CAAC,EAAEC;AAAtC,WAAsBqL,KAAtB,CAAP;AACD,OAFA,CAzCH,EA6CG7L,iBAAiB,iBAChB,KAAC,SAAD;AACE,QAAA,aAAa,EAAEC,aADjB;AAEE,QAAA,iBAAiB,EAAED,iBAFrB;AAGE,QAAA,OAAO,EAAEvB,OAHX;AAIE,QAAA,OAAO,EAAEwM,gBAJX;AAKE,QAAA,WAAW,EAAED,oBALf;AAME,QAAA,YAAY,EAAE,KAAKjJ,uBANrB;AAOE,QAAA,UAAU,EAAG+J,IAAD,IAAkB;AAC5B,eAAK/G,QAAL,CAAc;AAAEtG,YAAAA,OAAO,EAAEqN;AAAX,WAAd;AACD,SATH;AAUE,QAAA,QAAQ,EAAEZ;AAVZ,QA9CJ;AAAA,MADF;AA8DD;;AAvmCD;;AA0mCF,MAAMC,MAAM,GAAG3N,UAAU,CAACiE,MAAX,CAAkB;AAC/B2J,EAAAA,SAAS,EAAE;AACTW,IAAAA,UAAU,EAAE,QADH;AAETC,IAAAA,IAAI,EAAE,CAFG;AAGTC,IAAAA,cAAc,EAAE,QAHP;AAITC,IAAAA,QAAQ,EAAE,QAJD;AAKT9H,IAAAA,QAAQ,EAAE;AALD,GADoB;AAQ/BkH,EAAAA,WAAW,EAAE;AACXS,IAAAA,UAAU,EAAE,QADD;AAEXC,IAAAA,IAAI,EAAE,CAFK;AAGXC,IAAAA,cAAc,EAAE,QAHL;AAIXvN,IAAAA,KAAK,EAAE;AAJI;AARkB,CAAlB,CAAf;AAgBA,eAAeE,uBAAf;AAEA,SAASA,uBAAT","sourceRoot":"../../src"} diff --git a/lib/module/animations/index.js b/lib/module/animations/index.js deleted file mode 100644 index 3cf33e8..0000000 --- a/lib/module/animations/index.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -import { Animated, Easing } from 'react-native'; -export function getZoomToAnimation(animValue, toValue) { - return Animated.timing(animValue, { - easing: Easing.out(Easing.ease), - toValue, - useNativeDriver: true - }); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/animations/index.js.map b/lib/module/animations/index.js.map deleted file mode 100644 index b86d7ff..0000000 --- a/lib/module/animations/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["animations/index.ts"],"names":["Animated","Easing","getZoomToAnimation","animValue","toValue","timing","easing","out","ease","useNativeDriver"],"mappings":";;AAAA,SAASA,QAAT,EAAmBC,MAAnB,QAAiC,cAAjC;AAEA,OAAO,SAASC,kBAAT,CAA4BC,SAA5B,EAAuDC,OAAvD,EAAwE;AAC7E,SAAOJ,QAAQ,CAACK,MAAT,CAAgBF,SAAhB,EAA2B;AAChCG,IAAAA,MAAM,EAAEL,MAAM,CAACM,GAAP,CAAWN,MAAM,CAACO,IAAlB,CADwB;AAEhCJ,IAAAA,OAFgC;AAGhCK,IAAAA,eAAe,EAAE;AAHe,GAA3B,CAAP;AAKD","sourceRoot":"../../../src"} diff --git a/lib/module/assets/pin.png b/lib/module/assets/pin.png deleted file mode 100644 index 471a758..0000000 Binary files a/lib/module/assets/pin.png and /dev/null differ diff --git a/lib/module/components/AnimatedTouchFeedback.js b/lib/module/components/AnimatedTouchFeedback.js deleted file mode 100644 index 391b2e1..0000000 --- a/lib/module/components/AnimatedTouchFeedback.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; - -import React, { useEffect, useRef } from 'react'; -import { Animated, Easing, StyleSheet } from 'react-native'; -import { jsx as _jsx } from "react/jsx-runtime"; -export const AnimatedTouchFeedback = ({ - x, - y, - animationDelay, - animationDuration, - onAnimationDone -}) => { - const appearDisappearAnimRef = useRef(new Animated.Value(0)); - const onAnimationDoneRef = useRef(onAnimationDone); - onAnimationDoneRef.current = onAnimationDone; - useEffect(() => { - appearDisappearAnimRef.current.setValue(0); - const inDuration = animationDuration * 0.8; - const outDuration = animationDuration - inDuration; - Animated.sequence([Animated.timing(appearDisappearAnimRef.current, { - delay: animationDelay || 0, - toValue: 1, - duration: inDuration, - easing: Easing.linear, - useNativeDriver: true - }), Animated.timing(appearDisappearAnimRef.current, { - toValue: 0, - duration: outDuration, - easing: Easing.out(Easing.ease), - useNativeDriver: true - })]).start(() => onAnimationDoneRef.current?.()); - }, [animationDelay, animationDuration]); - return /*#__PURE__*/_jsx(Animated.View, { - pointerEvents: "none", - style: [styles.animatedTouchFeedback, { - opacity: appearDisappearAnimRef.current.interpolate({ - inputRange: [0, 1], - outputRange: [0, 0.3] - }), - left: x - 20, - top: y - 20, - transform: [{ - scale: appearDisappearAnimRef.current.interpolate({ - inputRange: [0, 1], - outputRange: [0.5, 1] - }) - }] - }] - }); -}; -const styles = StyleSheet.create({ - animatedTouchFeedback: { - backgroundColor: 'lightgray', - borderRadius: 40, - height: 40, - position: 'absolute', - width: 40 - } -}); -//# sourceMappingURL=AnimatedTouchFeedback.js.map \ No newline at end of file diff --git a/lib/module/components/AnimatedTouchFeedback.js.map b/lib/module/components/AnimatedTouchFeedback.js.map deleted file mode 100644 index ad2ea65..0000000 --- a/lib/module/components/AnimatedTouchFeedback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["components/AnimatedTouchFeedback.tsx"],"names":["React","useEffect","useRef","Animated","Easing","StyleSheet","AnimatedTouchFeedback","x","y","animationDelay","animationDuration","onAnimationDone","appearDisappearAnimRef","Value","onAnimationDoneRef","current","setValue","inDuration","outDuration","sequence","timing","delay","toValue","duration","easing","linear","useNativeDriver","out","ease","start","styles","animatedTouchFeedback","opacity","interpolate","inputRange","outputRange","left","top","transform","scale","create","backgroundColor","borderRadius","height","position","width"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,MAA3B,QAAyC,OAAzC;AACA,SAASC,QAAT,EAAmBC,MAAnB,EAA2BC,UAA3B,QAA6C,cAA7C;;AAEA,OAAO,MAAMC,qBAAqB,GAAG,CAAC;AACpCC,EAAAA,CADoC;AAEpCC,EAAAA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QAAD,CAAU,IAAV;AACE,IAAA,aAAa,EAAC,MADhB;AAEE,IAAA,KAAK,EAAE,CACLoB,MAAM,CAACC,qBADF,EAEL;AACEC,MAAAA,OAAO,EAAEpB,sBAAsB,CAACG,OAAvB,CAA+BkB,WAA/B,CAA2C;AAClDC,QAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CADsC;AAElDC,QAAAA,WAAW,EAAE,CAAC,CAAD,EAAI,GAAJ;AAFqC,OAA3C,CADX;AAKEC,MAAAA,IAAI,EAAE7B,CAAC,GAAG,EALZ;AAME8B,MAAAA,GAAG,EAAE7B,CAAC,GAAG,EANX;AAOE8B,MAAAA,SAAS,EAAE,CACT;AACEC,QAAAA,KAAK,EAAE3B,sBAAsB,CAACG,OAAvB,CAA+BkB,WAA/B,CAA2C;AAChDC,UAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CADoC;AAEhDC,UAAAA,WAAW,EAAE,CAAC,GAAD,EAAM,CAAN;AAFmC,SAA3C;AADT,OADS;AAPb,KAFK;AAFT,IADF;AAwBD,CA9DM;AAgEP,MAAML,MAAM,GAAGzB,UAAU,CAACmC,MAAX,CAAkB;AAC/BT,EAAAA,qBAAqB,EAAE;AACrBU,IAAAA,eAAe,EAAE,WADI;AAErBC,IAAAA,YAAY,EAAE,EAFO;AAGrBC,IAAAA,MAAM,EAAE,EAHa;AAIrBC,IAAAA,QAAQ,EAAE,UAJW;AAKrBC,IAAAA,KAAK,EAAE;AALc;AADQ,CAAlB,CAAf","sourceRoot":"../../../src"} diff --git a/lib/module/components/StaticPin.js b/lib/module/components/StaticPin.js deleted file mode 100644 index 50a8877..0000000 --- a/lib/module/components/StaticPin.js +++ /dev/null @@ -1,85 +0,0 @@ -"use strict"; - -import React from 'react'; -import { Animated, Image, PanResponder, StyleSheet, View } from 'react-native'; -import { jsx as _jsx } from "react/jsx-runtime"; -export const StaticPin = ({ - staticPinPosition, - staticPinIcon, - pinSize, - onParentMove, - onPress, - onLongPress, - setPinSize, - pinProps = {} -}) => { - const tapTime = React.useRef(0); - const transform = [{ - translateY: -pinSize.height - }, { - translateX: -pinSize.width / 2 - }]; - const opacity = pinSize.width && pinSize.height ? 1 : 0; - const panResponder = React.useRef(PanResponder.create({ - onStartShouldSetPanResponder: () => { - tapTime.current = Date.now(); // We want to handle tap on this so set true - - return true; - }, - onPanResponderMove: (evt, gestureState) => { - // However if the user moves finger we want to pass this evt to parent - // to handle panning (tap not recognized) - if (Math.abs(gestureState.dx) > 5 && Math.abs(gestureState.dy) > 5) onParentMove(evt, gestureState); - }, - onPanResponderRelease: (evt, gestureState) => { - if (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5) return; - const dt = Date.now() - tapTime.current; - - if (onPress && dt < 500) { - onPress(evt); - } - - if (onLongPress && dt > 500) { - // RN long press is 500ms - onLongPress(evt); - } - } - })).current; - return /*#__PURE__*/_jsx(Animated.View, { - style: [{ - left: staticPinPosition.x, - top: staticPinPosition.y - }, styles.pinWrapper, { - opacity, - transform - }], - ...pinProps, - children: /*#__PURE__*/_jsx(View, { - onLayout: ({ - nativeEvent: { - layout - } - }) => { - setPinSize(layout); - }, - ...panResponder.panHandlers, - children: staticPinIcon || - /*#__PURE__*/ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - _jsx(Image, { - source: require('../assets/pin.png'), - style: styles.pin - }) - }) - }); -}; -const styles = StyleSheet.create({ - pin: { - height: 64, - width: 48 - }, - pinWrapper: { - position: 'absolute' - } -}); -//# sourceMappingURL=StaticPin.js.map \ No newline at end of file diff --git a/lib/module/components/StaticPin.js.map b/lib/module/components/StaticPin.js.map deleted file mode 100644 index 36e5e06..0000000 --- a/lib/module/components/StaticPin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["components/StaticPin.tsx"],"names":["React","Animated","Image","PanResponder","StyleSheet","View","StaticPin","staticPinPosition","staticPinIcon","pinSize","onParentMove","onPress","onLongPress","setPinSize","pinProps","tapTime","useRef","transform","translateY","height","translateX","width","opacity","panResponder","create","onStartShouldSetPanResponder","current","Date","now","onPanResponderMove","evt","gestureState","Math","abs","dx","dy","onPanResponderRelease","dt","left","x","top","y","styles","pinWrapper","nativeEvent","layout","panHandlers","require","pin","position"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,QADF,EAGEC,KAHF,EAIEC,YAJF,EAMEC,UANF,EAOEC,IAPF,QASO,cATP;;AAYA,OAAO,MAAMC,SAAS,GAAG,CAAC;AACxBC,EAAAA,iBADwB;AAExBC,EAAAA,aAFwB;AAGxBC,EAAAA,OAHwB;AAIxBC,EAAAA,YAJwB;AAKxBC,EAAAA,OALwB;AAMxBC,EAAAA,WANwB;AAOxBC,EAAAA,UAPwB;AAQxBC,EAAAA,QAAQ,GAAG;AARa,CAAD,KAsBnB;AACJ,QAAMC,OAAO,GAAGf,KAAK,CAACgB,MAAN,CAAa,CAAb,CAAhB;AACA,QAAMC,SAAS,GAAG,CAChB;AAAEC,IAAAA,UAAU,EAAE,CAACT,OAAO,CAACU;AAAvB,GADgB,EAEhB;AAAEC,IAAAA,UAAU,EAAE,CAACX,OAAO,CAACY,KAAT,GAAiB;AAA/B,GAFgB,CAAlB;AAKA,QAAMC,OAAO,GAAGb,OAAO,CAACY,KAAR,IAAiBZ,OAAO,CAACU,MAAzB,GAAkC,CAAlC,GAAsC,CAAtD;AAEA,QAAMI,YAAY,GAAGvB,KAAK,CAACgB,MAAN,CACnBb,YAAY,CAACqB,MAAb,CAAoB;AAClBC,IAAAA,4BAA4B,EAAE,MAAM;AAClCV,MAAAA,OAAO,CAACW,OAAR,GAAkBC,IAAI,CAACC,GAAL,EAAlB,CADkC,CAGlC;;AACA,aAAO,IAAP;AACD,KANiB;AAOlBC,IAAAA,kBAAkB,EAAE,CAACC,GAAD,EAAMC,YAAN,KAAuB;AACzC;AACA;AACA,UAAIC,IAAI,CAACC,GAAL,CAASF,YAAY,CAACG,EAAtB,IAA4B,CAA5B,IAAiC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,KAAK,EAAEL,MAAM,CAACM;AAA3D;AARJ;AAXF,IADF;AAyBD,CArFM;AAuFP,MAAMN,MAAM,GAAGtC,UAAU,CAACoB,MAAX,CAAkB;AAC/BwB,EAAAA,GAAG,EAAE;AACH7B,IAAAA,MAAM,EAAE,EADL;AAEHE,IAAAA,KAAK,EAAE;AAFJ,GAD0B;AAK/BsB,EAAAA,UAAU,EAAE;AACVM,IAAAA,QAAQ,EAAE;AADA;AALmB,CAAlB,CAAf","sourceRoot":"../../../src"} diff --git a/lib/module/components/index.js b/lib/module/components/index.js deleted file mode 100644 index 040fe35..0000000 --- a/lib/module/components/index.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; - -export { AnimatedTouchFeedback } from './AnimatedTouchFeedback'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/index.js.map b/lib/module/components/index.js.map deleted file mode 100644 index 761a507..0000000 --- a/lib/module/components/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["components/index.tsx"],"names":["AnimatedTouchFeedback"],"mappings":";;AAAA,SAASA,qBAAT,QAAsC,yBAAtC","sourceRoot":"../../../src"} diff --git a/lib/module/debugHelper/index.js b/lib/module/debugHelper/index.js deleted file mode 100644 index f689e53..0000000 --- a/lib/module/debugHelper/index.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; - -import React from 'react'; -import { StyleSheet, View } from 'react-native'; -import { jsx as _jsx } from "react/jsx-runtime"; -export const DebugTouchPoint = ({ - diameter = 20, - x = 0, - y = 0, - color = 'yellow' -}) => { - const radius = diameter / 2; - return /*#__PURE__*/_jsx(View, { - style: [styles.debugPoint, { - width: diameter, - height: diameter, - borderRadius: diameter, - backgroundColor: color, - left: x - radius, - top: y - radius - }], - pointerEvents: "none" - }); -}; -export const DebugRect = ({ - height, - x = 0, - y = 0, - color = 'yellow' -}) => { - const width = 5; - return /*#__PURE__*/_jsx(View, { - style: [styles.debugRect, { - width, - height, - backgroundColor: color, - left: x - width / 2, - top: y - }], - pointerEvents: "none" - }); -}; -const styles = StyleSheet.create({ - debugPoint: { - opacity: 0.7, - position: 'absolute' - }, - debugRect: { - opacity: 0.5, - position: 'absolute' - } -}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/debugHelper/index.js.map b/lib/module/debugHelper/index.js.map deleted file mode 100644 index 1df0da0..0000000 --- a/lib/module/debugHelper/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["debugHelper/index.tsx"],"names":["React","StyleSheet","View","DebugTouchPoint","diameter","x","y","color","radius","styles","debugPoint","width","height","borderRadius","backgroundColor","left","top","DebugRect","debugRect","create","opacity","position"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;;AAEA,OAAO,MAAMC,eAAe,GAAG,CAAC;AAC9BC,EAAAA,QAAQ,GAAG,EADmB;AAE9BC,EAAAA,CAAC,GAAG,CAF0B;AAG9BC,EAAAA,CAAC,GAAG,CAH0B;AAI9BC,EAAAA,KAAK,GAAG;AAJsB,CAAD,KAKzB;AACJ,QAAMC,MAAM,GAAGJ,QAAQ,GAAG,CAA1B;AACA,sBACE,KAAC,IAAD;AACE,IAAA,KAAK,EAAE,CACLK,MAAM,CAACC,UADF,EAEL;AACEC,MAAAA,KAAK,EAAEP,QADT;AAEEQ,MAAAA,MAAM,EAAER,QAFV;AAGES,MAAAA,YAAY,EAAET,QAHhB;AAIEU,MAAAA,eAAe,EAAEP,KAJnB;AAKEQ,MAAAA,IAAI,EAAEV,CAAC,GAAGG,MALZ;AAMEQ,MAAAA,GAAG,EAAEV,CAAC,GAAGE;AANX,KAFK,CADT;AAYE,IAAA,aAAa,EAAC;AAZhB,IADF;AAgBD,CAvBM;AAwBP,OAAO,MAAMS,SAAS,GAAG,CAAC;AACxBL,EAAAA,MADwB;AAExBP,EAAAA,CAAC,GAAG,CAFoB;AAGxBC,EAAAA,CAAC,GAAG,CAHoB;AAIxBC,EAAAA,KAAK,GAAG;AAJgB,CAAD,KAUnB;AACJ,QAAMI,KAAK,GAAG,CAAd;AACA,sBACE,KAAC,IAAD;AACE,IAAA,KAAK,EAAE,CACLF,MAAM,CAACS,SADF,EAEL;AACEP,MAAAA,KADF;AAEEC,MAAAA,MAFF;AAGEE,MAAAA,eAAe,EAAEP,KAHnB;AAIEQ,MAAAA,IAAI,EAAEV,CAAC,GAAGM,KAAK,GAAG,CAJpB;AAKEK,MAAAA,GAAG,EAAEV;AALP,KAFK,CADT;AAWE,IAAA,aAAa,EAAC;AAXhB,IADF;AAeD,CA3BM;AA6BP,MAAMG,MAAM,GAAGR,UAAU,CAACkB,MAAX,CAAkB;AAC/BT,EAAAA,UAAU,EAAE;AACVU,IAAAA,OAAO,EAAE,GADC;AAEVC,IAAAA,QAAQ,EAAE;AAFA,GADmB;AAK/BH,EAAAA,SAAS,EAAE;AACTE,IAAAA,OAAO,EAAE,GADA;AAETC,IAAAA,QAAQ,EAAE;AAFD;AALoB,CAAlB,CAAf","sourceRoot":"../../../src"} diff --git a/lib/module/helper/calcNewScaledOffsetForZoomCentering.js b/lib/module/helper/calcNewScaledOffsetForZoomCentering.js deleted file mode 100644 index 55240c1..0000000 --- a/lib/module/helper/calcNewScaledOffsetForZoomCentering.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; - -/** - * Calculates the new offset for the zoomSubject to ensure zoom center position is retained after zooming. - * Parameters should correspond to whether we need the offset for the X or Y axis - * - * ## Terms Used: - * - * - Zoom Subject: the view that's being zoomed and panned - * - Zoom Center: the point whose relative position to the window is retained - * - Unscaled: a measurement in pixels denoting the true size as observed by the users' eyes - * - Scaled: a measurement in pixels scaled to the "scale transformation" of the zoom subject to match with its true size. - * *For example:* - * If the scale on the zoom subject is 0.5, - * then to draw an actual 4px line on the zoom subject, we need to scale it to 4px / 0.5 = 8px - * 8px is the scaled measurement - * - * ## Overall idea of this algorithm: - * - * When users perform zooming by pinching the screen, - * we need to shift the zoom subject so that the position of the zoom center is always the same. - * The offset amount to shift the layer is the returned value. - * - * - * ## How we achieve our goal: - * - * To retain, the zoom center position, whenever a zoom action is performed, - * we just need to make sure the distances from all the points in the zoom subject - * to the zoom center increases or decreases by the growth rate of the scale. - * - * ``` - * newDistanceAnyPointToZoomCenter = oldDistanceAnyPointToZoomCenter * (newScale/oldScale) - * ``` - * - * We can't calculate that for all the points because there are unlimited points on a plain. - * However, due to the way `transform` works in RN, every point is scaled from the zoom subject center. - * Therefore, it's sufficient to base our calculation on the distance from the zoom subject center to the zoom center. - * - * ``` - * newDistanceZoomSubjectCenterToZoomCenter = oldDistanceZoomSubjectCenterToZoomCenter * (newScale/oldScale) - * ``` - * - * Once we have `newDistanceZoomSubjectCenterToZoomCenter`, - * we can easily calculate the position of the new center, which leads us to the offset amount. - * Refer to the code for more details - * - * @param oldOffsetXOrYScaled - * @param zoomSubjectOriginalWidthOrHeight - * @param oldScale - * @param newScale - * @param zoomCenterXOrY - */ -export function calcNewScaledOffsetForZoomCentering(oldOffsetXOrYScaled, zoomSubjectOriginalWidthOrHeight, oldScale, newScale, zoomCenterXOrY) { - const oldOffSetUnscaled = oldOffsetXOrYScaled * oldScale; - const growthRate = newScale / oldScale; // these act like namespaces just for the sake of readability - - const zoomSubjectOriginalCenter = {}; - const zoomSubjectCurrentCenter = {}; - const zoomSubjectNewCenter = {}; - zoomSubjectOriginalCenter.xOrY = zoomSubjectOriginalWidthOrHeight / 2; - zoomSubjectCurrentCenter.xOrY = zoomSubjectOriginalCenter.xOrY + oldOffSetUnscaled; - zoomSubjectCurrentCenter.distanceToZoomCenter = zoomSubjectCurrentCenter.xOrY - zoomCenterXOrY; - zoomSubjectNewCenter.distanceToZoomCenter = zoomSubjectCurrentCenter.distanceToZoomCenter * growthRate; - zoomSubjectNewCenter.xOrY = zoomSubjectNewCenter.distanceToZoomCenter + zoomCenterXOrY; - const newOffsetUnscaled = zoomSubjectNewCenter.xOrY - zoomSubjectOriginalCenter.xOrY; - return newOffsetUnscaled / newScale; -} -//# sourceMappingURL=calcNewScaledOffsetForZoomCentering.js.map \ No newline at end of file diff --git a/lib/module/helper/calcNewScaledOffsetForZoomCentering.js.map b/lib/module/helper/calcNewScaledOffsetForZoomCentering.js.map deleted file mode 100644 index 93a364e..0000000 --- a/lib/module/helper/calcNewScaledOffsetForZoomCentering.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["helper/calcNewScaledOffsetForZoomCentering.ts"],"names":["calcNewScaledOffsetForZoomCentering","oldOffsetXOrYScaled","zoomSubjectOriginalWidthOrHeight","oldScale","newScale","zoomCenterXOrY","oldOffSetUnscaled","growthRate","zoomSubjectOriginalCenter","zoomSubjectCurrentCenter","zoomSubjectNewCenter","xOrY","distanceToZoomCenter","newOffsetUnscaled"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mCAAT,CACLC,mBADK,EAELC,gCAFK,EAGLC,QAHK,EAILC,QAJK,EAKLC,cALK,EAML;AACA,QAAMC,iBAAiB,GAAGL,mBAAmB,GAAGE,QAAhD;AACA,QAAMI,UAAU,GAAGH,QAAQ,GAAGD,QAA9B,CAFA,CAIA;;AACA,QAAMK,yBAAyB,GAAG,EAAlC;AACA,QAAMC,wBAAwB,GAAG,EAAjC;AACA,QAAMC,oBAAoB,GAAG,EAA7B;AAEAF,EAAAA,yBAAyB,CAACG,IAA1B,GAAiCT,gCAAgC,GAAG,CAApE;AACAO,EAAAA,wBAAwB,CAACE,IAAzB,GACEH,yBAAyB,CAACG,IAA1B,GAAiCL,iBADnC;AAEAG,EAAAA,wBAAwB,CAACG,oBAAzB,GACEH,wBAAwB,CAACE,IAAzB,GAAgCN,cADlC;AAGAK,EAAAA,oBAAoB,CAACE,oBAArB,GACEH,wBAAwB,CAACG,oBAAzB,GAAgDL,UADlD;AAEAG,EAAAA,oBAAoB,CAACC,IAArB,GACED,oBAAoB,CAACE,oBAArB,GAA4CP,cAD9C;AAGA,QAAMQ,iBAAiB,GACrBH,oBAAoB,CAACC,IAArB,GAA4BH,yBAAyB,CAACG,IADxD;AAGA,SAAOE,iBAAiB,GAAGT,QAA3B;AACD","sourceRoot":"../../../src"} diff --git a/lib/module/helper/coordinateConversion.js b/lib/module/helper/coordinateConversion.js deleted file mode 100644 index cd2e16a..0000000 --- a/lib/module/helper/coordinateConversion.js +++ /dev/null @@ -1,112 +0,0 @@ -"use strict"; - -export const defaultTransformSubjectData = { - offsetX: 0, - offsetY: 0, - zoomLevel: 0, - originalWidth: 0, - originalHeight: 0, - originalPageX: 0, - originalPageY: 0 -}; -/** - * Assuming you have an image that's being resized to fit into a container - * using the "contain" resize mode. You can use this function to calculate the - * size of the image after fitting. - * - * Since our sheet is resized in this manner, we need this function - * for things like pan boundaries and marker placement - * - * @param imgSize - * @param containerSize - */ - -export function applyContainResizeMode(imgSize, containerSize) { - const { - width: imageWidth, - height: imageHeight - } = imgSize; - const { - width: areaWidth, - height: areaHeight - } = containerSize; - const imageAspect = imageWidth / imageHeight; - const areaAspect = areaWidth / areaHeight; - let newSize; - - if (imageAspect >= areaAspect) { - // longest edge is horizontal - newSize = { - width: areaWidth, - height: areaWidth / imageAspect - }; - } else { - // longest edge is vertical - newSize = { - width: areaHeight * imageAspect, - height: areaHeight - }; - } - - if (isNaN(newSize.height)) newSize.height = areaHeight; - if (isNaN(newSize.width)) newSize.width = areaWidth; - const scale = imageWidth ? newSize.width / imageWidth : newSize.height / imageHeight; - if (!isFinite(scale)) return { - size: null, - scale: null - }; - return { - size: newSize, - scale - }; -} -/** - * get the coord of image's origin relative to the transformSubject - * @param resizedImageSize - * @param transformSubject - */ - -export function getImageOriginOnTransformSubject(resizedImageSize, transformSubject) { - const { - offsetX, - offsetY, - zoomLevel, - originalWidth, - originalHeight - } = transformSubject; - return { - x: offsetX * zoomLevel + originalWidth / 2 - resizedImageSize.width / 2 * zoomLevel, - y: offsetY * zoomLevel + originalHeight / 2 - resizedImageSize.height / 2 * zoomLevel - }; -} -/** - * Translates the coord system of a point from the viewport's space to the image's space - * - * @param pointOnContainer - * @param sheetImageSize - * @param transformSubject - * - * @return {Vec2D} returns null if point is out of the sheet's bound - */ - -export function viewportPositionToImagePosition({ - viewportPosition, - imageSize, - zoomableEvent -}) { - const { - size: resizedImgSize, - scale: resizedImgScale - } = applyContainResizeMode(imageSize, { - width: zoomableEvent.originalWidth, - height: zoomableEvent.originalHeight - }); - if (resizedImgScale == null) return null; - const sheetOriginOnContainer = getImageOriginOnTransformSubject(resizedImgSize, zoomableEvent); - const pointOnSheet = { - x: (viewportPosition.x - sheetOriginOnContainer.x) / zoomableEvent.zoomLevel / resizedImgScale, - y: (viewportPosition.y - sheetOriginOnContainer.y) / zoomableEvent.zoomLevel / resizedImgScale - }; - return pointOnSheet; -} -//# sourceMappingURL=coordinateConversion.js.map \ No newline at end of file diff --git a/lib/module/helper/coordinateConversion.js.map b/lib/module/helper/coordinateConversion.js.map deleted file mode 100644 index dd0e207..0000000 --- a/lib/module/helper/coordinateConversion.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["helper/coordinateConversion.ts"],"names":["defaultTransformSubjectData","offsetX","offsetY","zoomLevel","originalWidth","originalHeight","originalPageX","originalPageY","applyContainResizeMode","imgSize","containerSize","width","imageWidth","height","imageHeight","areaWidth","areaHeight","imageAspect","areaAspect","newSize","isNaN","scale","isFinite","size","getImageOriginOnTransformSubject","resizedImageSize","transformSubject","x","y","viewportPositionToImagePosition","viewportPosition","imageSize","zoomableEvent","resizedImgSize","resizedImgScale","sheetOriginOnContainer","pointOnSheet"],"mappings":";;AAEA,OAAO,MAAMA,2BAA8C,GAAG;AAC5DC,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AE7DD,aAF6D,CAA/D;AAKA,QAAMI,YAAY,GAAG;AACnBT,IAAAA,CAAC,EACC,CAACG,gBAAgB,CAACH,CAAjB,GAAqBQ,sBAAsB,CAACR,CAA7C,IACAK,aAAa,CAAC7B,SADd,GAEA+B,eAJiB;AAKnBN,IAAAA,CAAC,EACC,CAACE,gBAAgB,CAACF,CAAjB,GAAqBO,sBAAsB,CAACP,CAA7C,IACAI,aAAa,CAAC7B,SADd,GAEA+B;AARiB,GAArB;AAWA,SAAOE,YAAP;AACD","sourceRoot":"../../../src"} diff --git a/lib/module/helper/index.js b/lib/module/helper/index.js deleted file mode 100644 index 2c83de5..0000000 --- a/lib/module/helper/index.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; - -export { calcNewScaledOffsetForZoomCentering } from './calcNewScaledOffsetForZoomCentering'; -/** - * Calculates the gesture center point relative to the page coordinate system - * - * We're unable to use touch.locationX/Y - * because locationX uses the axis system of the leaf element that the touch occurs on, - * which makes it even more complicated to translate into our container's axis system. - * - * We're also unable to use gestureState.moveX/Y - * because gestureState.moveX/Y is messed up on real device - * (Sometimes it's the center point, but sometimes it randomly takes the position of one of the touches) - */ - -export function calcGestureCenterPoint(e, gestureState) { - const touches = e.nativeEvent.touches; - if (!touches[0]) return null; - - if (gestureState.numberActiveTouches === 2) { - if (!touches[1]) return null; - return { - x: (touches[0].pageX + touches[1].pageX) / 2, - y: (touches[0].pageY + touches[1].pageY) / 2 - }; - } - - if (gestureState.numberActiveTouches === 1) { - return { - x: touches[0].pageX, - y: touches[0].pageY - }; - } - - return null; -} -export function calcGestureTouchDistance(e, gestureState) { - const touches = e.nativeEvent.touches; - if (gestureState.numberActiveTouches !== 2 || !touches[0] || !touches[1]) return null; - const dx = Math.abs(touches[0].pageX - touches[1].pageX); - const dy = Math.abs(touches[0].pageY - touches[1].pageY); - return Math.sqrt(dx * dx + dy * dy); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/helper/index.js.map b/lib/module/helper/index.js.map deleted file mode 100644 index 3a2fb9e..0000000 --- a/lib/module/helper/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["helper/index.ts"],"names":["calcNewScaledOffsetForZoomCentering","calcGestureCenterPoint","e","gestureState","touches","nativeEvent","numberActiveTouches","x","pageX","y","pageY","calcGestureTouchDistance","dx","Math","abs","dy","sqrt"],"mappings":";;AAIA,SAASA,mCAAT,QAAoD,uCAApD;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sBAAT,CACLC,CADK,EAELC,YAFK,EAGS;AACd,QAAMC,OAAO,GAAGF,CAAC,CAACG,WAAF,CAAcD,OAA9B;AACA,MAAI,CAACA,OAAO,CAAC,CAAD,CAAZ,EAAiB,OAAO,IAAP;;AAEjB,MAAID,YAAY,CAACG,mBAAb,KAAqC,CAAzC,EAA4C;AAC1C,QAAI,CAACF,OAAO,CAAC,CAAD,CAAZ,EAAiB,OAAO,IAAP;AACjB,WAAO;AACLG,MAAAA,CAAC,EAAE,CAACH,OAAO,CAAC,CAAD,CAAP,CAAWI,KAAX,GAAmBJ,OAAO,CAAC,CAAD,CAAP,CAAWI,KAA/B,IAAwC,CADtC;AAELC,MAAAA,CAAC,EAAE,CAACL,OAAO,CAAC,CAAD,CAAP,CAAWM,KAAX,GAAmBN,OAAO,CAAC,CAAD,CAAP,CAAWM,KAA/B,IAAwC;AAFtC,KAAP;AAID;;AACD,MAAIP,YAAY,CAACG,mBAAb,KAAqC,CAAzC,EAA4C;AAC1C,WAAO;AACLC,MAAAA,CAAC,EAAEH,OAAO,CAAC,CAAD,CAAP,CAAWI,KADT;AAELC,MAAAA,CAAC,EAAEL,OAAO,CAAC,CAAD,CAAP,CAAWM;AAFT,KAAP;AAID;;AAED,SAAO,IAAP;AACD;AAED,OAAO,SAASC,wBAAT,CACLT,CADK,EAELC,YAFK,EAGU;AACf,QAAMC,OAAO,GAAGF,CAAC,CAACG,WAAF,CAAcD,OAA9B;AACA,MAAID,YAAY,CAACG,mBAAb,KAAqC,CAArC,IAA0C,CAACF,OAAO,CAAC,CAAD,CAAlD,IAAyD,CAACA,OAAO,CAAC,CAAD,CAArE,EACE,OAAO,IAAP;AAEF,QAAMQ,EAAE,GAAGC,IAAI,CAACC,GAAL,CAASV,OAAO,CAAC,CAAD,CAAP,CAAWI,KAAX,GAAmBJ,OAAO,CAAC,CAAD,CAAP,CAAWI,KAAvC,CAAX;AACA,QAAMO,EAAE,GAAGF,IAAI,CAACC,GAAL,CAASV,OAAO,CAAC,CAAD,CAAP,CAAWM,KAAX,GAAmBN,OAAO,CAAC,CAAD,CAAP,CAAWM,KAAvC,CAAX;AACA,SAAOG,IAAI,CAACG,IAAL,CAAUJ,EAAE,GAAGA,EAAL,GAAUG,EAAE,GAAGA,EAAzB,CAAP;AACD","sourceRoot":"../../../src"} diff --git a/lib/module/hooks/useLatestCallback.js.map b/lib/module/hooks/useLatestCallback.js.map deleted file mode 100644 index 5d8e1ec..0000000 --- a/lib/module/hooks/useLatestCallback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["hooks/useLatestCallback.ts"],"names":["useRef","useLatestCallback","callback","ref","current","args"],"mappings":";;AAAA,SAASA,MAAT,QAAuB,OAAvB;AAEA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,iBAAiB,GAC5BC,QAD+B,IAE5B;AACH,QAAMC,GAAG,GAAGH,MAAM,CAACE,QAAD,CAAlB;AACAC,EAAAA,GAAG,CAACC,OAAJ,GAAcF,QAAd;AAEA,SAAOF,MAAM,CAAkB,CAAC,GAAGK,IAAJ,KAAaF,GAAG,CAACC,OAAJ,CAAY,GAAGC,IAAf,CAA/B,CAAN,CAA2DD,OAAlE;AACD,CAPM","sourceRoot":"../../../src"} diff --git a/lib/module/index.js b/lib/module/index.js deleted file mode 100644 index aaecdc0..0000000 --- a/lib/module/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -import { applyContainResizeMode, getImageOriginOnTransformSubject, viewportPositionToImagePosition } from './helper/coordinateConversion'; -import ReactNativeZoomableView from './ReactNativeZoomableView'; -export { // Helper functions for coordinate conversion -applyContainResizeMode, getImageOriginOnTransformSubject, ReactNativeZoomableView, viewportPositionToImagePosition }; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/index.js.map b/lib/module/index.js.map deleted file mode 100644 index 2f14644..0000000 --- a/lib/module/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["index.tsx"],"names":["applyContainResizeMode","getImageOriginOnTransformSubject","viewportPositionToImagePosition","ReactNativeZoomableView"],"mappings":";;AAAA,SACEA,sBADF,EAEEC,gCAFF,EAGEC,+BAHF,QAIO,+BAJP;AAKA,OAAOC,uBAAP,MAAoC,2BAApC;AAMA,SACE;AACAH,sBAFF,EAGEC,gCAHF,EAIEE,uBAJF,EAMED,+BANF","sourceRoot":"../../src"} diff --git a/lib/module/package.json b/lib/module/package.json deleted file mode 100644 index 089153b..0000000 --- a/lib/module/package.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"module"} diff --git a/lib/module/typings/index.js b/lib/module/typings/index.js deleted file mode 100644 index f9391cf..0000000 --- a/lib/module/typings/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -export let SwipeDirection = /*#__PURE__*/function (SwipeDirection) { - SwipeDirection["SWIPE_UP"] = "SWIPE_UP"; - SwipeDirection["SWIPE_DOWN"] = "SWIPE_DOWN"; - SwipeDirection["SWIPE_LEFT"] = "SWIPE_LEFT"; - SwipeDirection["SWIPE_RIGHT"] = "SWIPE_RIGHT"; - return SwipeDirection; -}({}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/typings/index.js.map b/lib/module/typings/index.js.map deleted file mode 100644 index 11cbb3f..0000000 --- a/lib/module/typings/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["typings/index.ts"],"names":["SwipeDirection"],"mappings":";;AASA,WAAYA,cAAZ,0BAAYA,cAAZ;AAAYA,EAAAA,cAAZ;AAAYA,EAAAA,cAAZ;AAAYA,EAAAA,cAAZ;AAAYA,EAAAA,cAAZ;AAAA,SAAYA,cAAZ;AAAA","sourceRoot":"../../../src"} diff --git a/lib/typescript/ReactNativeZoomableView.d.ts b/lib/typescript/ReactNativeZoomableView.d.ts deleted file mode 100644 index 2efe831..0000000 --- a/lib/typescript/ReactNativeZoomableView.d.ts +++ /dev/null @@ -1,235 +0,0 @@ -/// -import { Component, RefObject } from 'react'; -import { GestureResponderEvent, PanResponderCallbacks, PanResponderGestureState, PanResponderInstance, View } from 'react-native'; -import { ReactNativeZoomableViewProps, ReactNativeZoomableViewState, Vec2D, ZoomableViewEvent } from './typings'; -declare class ReactNativeZoomableView extends Component { - zoomSubjectWrapperRef: RefObject; - gestureHandlers: PanResponderInstance; - doubleTapFirstTapReleaseTimestamp: number | undefined; - static defaultProps: { - zoomEnabled: boolean; - panEnabled: boolean; - initialZoom: number; - initialOffsetX: number; - initialOffsetY: number; - maxZoom: number; - minZoom: number; - pinchToZoomInSensitivity: number; - pinchToZoomOutSensitivity: number; - movementSensibility: number; - doubleTapDelay: number; - zoomStep: number; - onLongPress: null; - longPressDuration: number; - contentWidth: undefined; - contentHeight: undefined; - visualTouchFeedbackEnabled: boolean; - staticPinPosition: undefined; - staticPinIcon: undefined; - onStaticPinPositionChange: undefined; - onStaticPinPositionMove: undefined; - disablePanOnInitialZoom: boolean; - }; - private panAnim; - private readonly zoomAnim; - private offsetX; - private offsetY; - private zoomLevel; - private lastGestureCenterPosition; - private lastGestureTouchDistance; - private gestureType; - private _gestureStarted; - private set gestureStarted(value); - get gestureStarted(): boolean; - /** - * Last press time (used to evaluate whether user double tapped) - * @type {number} - */ - private longPressTimeout; - private onTransformInvocationInitialized; - private singleTapTimeoutId; - private touches; - private doubleTapFirstTap; - private measureZoomSubjectInterval; - constructor(props: ReactNativeZoomableViewProps); - componentDidUpdate(prevProps: ReactNativeZoomableViewProps, prevState: ReactNativeZoomableViewState): void; - componentDidMount(): void; - componentWillUnmount(): void; - debouncedOnStaticPinPositionChange: import("lodash").DebouncedFunc<(position: Vec2D) => void | undefined>; - /** - * try to invoke onTransform - * @private - */ - _invokeOnTransform(): { - successful: boolean; - }; - /** - * Returns additional information about components current state for external event hooks - * - * @returns {{}} - * @private - */ - _getZoomableViewEventObject(overwriteObj?: {}): ZoomableViewEvent; - /** - * Get the original box dimensions and save them for later use. - * (They will be used to calculate boxBorders) - * - * @private - */ - private measureZoomSubject; - /** - * Handles the start of touch events and checks for taps - * - * @param e - * @param gestureState - * @returns {boolean} - * - * @private - */ - _handleStartShouldSetPanResponder: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean; - /** - * Calculates pinch distance - * - * @param e - * @param gestureState - * @private - */ - _handlePanResponderGrant: NonNullable; - /** - * Handles the end of touch events - * - * @param e - * @param gestureState - * - * @private - */ - _handlePanResponderEnd: NonNullable; - /** - * Handles the actual movement of our pan responder - * - * @param e - * @param gestureState - * - * @private - */ - _handlePanResponderMove: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean | undefined; - /** - * Handles the pinch movement and zooming - * - * @param e - * @param gestureState - * - * @private - */ - _handlePinching(e: GestureResponderEvent, gestureState: PanResponderGestureState): void; - /** - * Used to debug pinch events - * @param gestureResponderEvent - * @param zoomCenter - * @param points - */ - _setPinchDebugPoints(gestureResponderEvent: GestureResponderEvent, zoomCenter: Vec2D, ...points: Vec2D[]): void; - /** - * Calculates the amount the offset should shift since the last position during panning - * - * @param {Vec2D} gestureCenterPoint - * - * @private - */ - _calcOffsetShiftSinceLastGestureState(gestureCenterPoint: Vec2D): { - x: number; - y: number; - } | null; - /** - * Handles movement by tap and move - * - * @param gestureState - * - * @private - */ - _handleShifting(gestureState: PanResponderGestureState): void; - /** - * Set the state to offset moved - * - * @param {number} newOffsetX - * @param {number} newOffsetY - * @returns - */ - _setNewOffsetPosition(newOffsetX: number, newOffsetY: number): void; - /** - * Check whether the press event is double tap - * or single tap and handle the event accordingly - * - * @param e - * - * @private - */ - private _resolveAndHandleTap; - moveStaticPinTo: (position: Vec2D, duration?: number) => void; - private _staticPinPosition; - private _updateStaticPin; - private _addTouch; - private _removeTouch; - /** - * Handles the double tap event - * - * @param e - * - * @private - */ - _handleDoubleTap(e: GestureResponderEvent): void; - /** - * Returns the next zoom step based on current step and zoomStep property. - * If we are zoomed all the way in -> return to initialzoom - * - * @returns {*} - */ - _getNextZoomStep(): number | undefined; - /** - * Zooms to a specific level. A "zoom center" can be provided, which specifies - * the point that will remain in the same position on the screen after the zoom. - * The coordinates of the zoom center is relative to the zoom subject. - * { x: 0, y: 0 } is the very center of the zoom subject. - * - * @param newZoomLevel - * @param zoomCenter - If not supplied, the container's center is the zoom center - */ - zoomTo(newZoomLevel: number, zoomCenter?: Vec2D): boolean; - /** - * Zooms in or out by a specified change level - * Use a positive number for `zoomLevelChange` to zoom in - * Use a negative number for `zoomLevelChange` to zoom out - * - * Returns a promise if everything was updated and a boolean, whether it could be updated or if it exceeded the min/max zoom limits. - * - * @param {number | null} zoomLevelChange - * - * @return {bool} - */ - zoomBy(zoomLevelChange: number): boolean; - /** - * Moves the zoomed view to a specified position - * Returns a promise when finished - * - * @param {number} newOffsetX the new position we want to move it to (x-axis) - * @param {number} newOffsetY the new position we want to move it to (y-axis) - * - * @return {bool} - */ - moveTo(newOffsetX: number, newOffsetY: number): void; - /** - * Moves the zoomed view by a certain amount. - * - * Returns a promise when finished - * - * @param {number} offsetChangeX the amount we want to move the offset by (x-axis) - * @param {number} offsetChangeY the amount we want to move the offset by (y-axis) - * - * @return {bool} - */ - moveBy(offsetChangeX: number, offsetChangeY: number): void; - render(): JSX.Element; -} -export default ReactNativeZoomableView; -export { ReactNativeZoomableView }; -//# sourceMappingURL=ReactNativeZoomableView.d.ts.map \ No newline at end of file diff --git a/lib/typescript/ReactNativeZoomableView.d.ts.map b/lib/typescript/ReactNativeZoomableView.d.ts.map deleted file mode 100644 index bc63e01..0000000 --- a/lib/typescript/ReactNativeZoomableView.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ReactNativeZoomableView.d.ts","sourceRoot":"","sources":["../../src/ReactNativeZoomableView.tsx"],"names":[],"mappings":";AACA,OAAc,EAAE,SAAS,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAEL,qBAAqB,EAErB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EAEpB,IAAI,EACL,MAAM,cAAc,CAAC;AAYtB,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAG5B,KAAK,EACL,iBAAiB,EAClB,MAAM,WAAW,CAAC;AAYnB,cAAM,uBAAwB,SAAQ,SAAS,CAC7C,4BAA4B,EAC5B,4BAA4B,CAC7B;IACC,qBAAqB,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IACvC,eAAe,EAAE,oBAAoB,CAAC;IACtC,iCAAiC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEtD,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;;;MAuBjB;IAEF,OAAO,CAAC,OAAO,CAAwC;IACvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAElD,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,OAAO,CAAK;IAEpB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,yBAAyB,CAAyC;IAC1E,OAAO,CAAC,wBAAwB,CAAuB;IACvD,OAAO,CAAC,WAAW,CAA2B;IAE9C,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,KAAK,cAAc,QAEzB;IAED,IAAW,cAAc,IAJK,OAAO,CAMpC;IAED;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,gCAAgC,CAAsB;IAC9D,OAAO,CAAC,kBAAkB,CAA6B;IACvD,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,iBAAiB,CAAyB;IAClD,OAAO,CAAC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ItB;IAEF,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,YAAY;IAKpB;;;;;;OAMG;IACH,gBAAgB,CAAC,CAAC,EAAE,qBAAqB;IA+BzC;;;;;OAKG;IACH,gBAAgB;IAoBhB;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,KAAK;IA+C/C;;;;;;;;;;OAUG;IACH,MAAM,CAAC,eAAe,EAAE,MAAM;IAM9B;;;;;;;;OAQG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAU7C;;;;;;;;;OASG;IACH,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IASnD,MAAM;CA6EP;AAkBD,eAAe,uBAAuB,CAAC;AAEvC,OAAO,EAAE,uBAAuB,EAAE,CAAC"} \ No newline at end of file diff --git a/lib/typescript/animations/index.d.ts b/lib/typescript/animations/index.d.ts deleted file mode 100644 index 06cf7dd..0000000 --- a/lib/typescript/animations/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Animated } from 'react-native'; -export declare function getZoomToAnimation(animValue: Animated.Value, toValue: number): Animated.CompositeAnimation; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/typescript/animations/index.d.ts.map b/lib/typescript/animations/index.d.ts.map deleted file mode 100644 index d11620f..0000000 --- a/lib/typescript/animations/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/animations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAU,MAAM,cAAc,CAAC;AAEhD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,+BAM5E"} \ No newline at end of file diff --git a/lib/typescript/components/AnimatedTouchFeedback.d.ts b/lib/typescript/components/AnimatedTouchFeedback.d.ts deleted file mode 100644 index f0323bf..0000000 --- a/lib/typescript/components/AnimatedTouchFeedback.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export declare const AnimatedTouchFeedback: ({ x, y, animationDelay, animationDuration, onAnimationDone, }: { - x: number; - y: number; - animationDuration: number; - animationDelay?: number | undefined; - onAnimationDone?: (() => void) | undefined; -}) => JSX.Element; -//# sourceMappingURL=AnimatedTouchFeedback.d.ts.map \ No newline at end of file diff --git a/lib/typescript/components/AnimatedTouchFeedback.d.ts.map b/lib/typescript/components/AnimatedTouchFeedback.d.ts.map deleted file mode 100644 index e169ac3..0000000 --- a/lib/typescript/components/AnimatedTouchFeedback.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"AnimatedTouchFeedback.d.ts","sourceRoot":"","sources":["../../../src/components/AnimatedTouchFeedback.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB;OAO7B,MAAM;OACN,MAAM;uBACU,MAAM;;6BAED,IAAI;iBAmD7B,CAAC"} \ No newline at end of file diff --git a/lib/typescript/components/StaticPin.d.ts b/lib/typescript/components/StaticPin.d.ts deleted file mode 100644 index 96d65ff..0000000 --- a/lib/typescript/components/StaticPin.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import { GestureResponderEvent, PanResponderGestureState, ViewProps } from 'react-native'; -import { Size2D } from 'src/typings'; -export declare const StaticPin: ({ staticPinPosition, staticPinIcon, pinSize, onParentMove, onPress, onLongPress, setPinSize, pinProps, }: { - staticPinPosition: { - x: number; - y: number; - }; - staticPinIcon: React.ReactNode; - pinSize: Size2D; - /** Internal handler for passing move event to parent */ - onParentMove: (evt: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean | undefined; - onPress?: ((evt: GestureResponderEvent) => void) | undefined; - onLongPress?: ((evt: GestureResponderEvent) => void) | undefined; - setPinSize: (size: Size2D) => void; - pinProps?: ViewProps | undefined; -}) => JSX.Element; -//# sourceMappingURL=StaticPin.d.ts.map \ No newline at end of file diff --git a/lib/typescript/components/StaticPin.d.ts.map b/lib/typescript/components/StaticPin.d.ts.map deleted file mode 100644 index 2427d03..0000000 --- a/lib/typescript/components/StaticPin.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"StaticPin.d.ts","sourceRoot":"","sources":["../../../src/components/StaticPin.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,qBAAqB,EAGrB,wBAAwB,EAGxB,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,eAAO,MAAM,SAAS;uBAUD;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;mBAC5B,MAAM,SAAS;aACrB,MAAM;IACf,wDAAwD;wBAEjD,qBAAqB,gBACZ,wBAAwB,KACnC,OAAO,GAAG,SAAS;qBACR,qBAAqB,KAAK,IAAI;yBAC1B,qBAAqB,KAAK,IAAI;uBAC/B,MAAM,KAAK,IAAI;;iBAiEnC,CAAC"} \ No newline at end of file diff --git a/lib/typescript/components/index.d.ts b/lib/typescript/components/index.d.ts deleted file mode 100644 index dbcaede..0000000 --- a/lib/typescript/components/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { AnimatedTouchFeedback } from './AnimatedTouchFeedback'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/typescript/components/index.d.ts.map b/lib/typescript/components/index.d.ts.map deleted file mode 100644 index 7c9cccd..0000000 --- a/lib/typescript/components/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"} \ No newline at end of file diff --git a/lib/typescript/debugHelper/index.d.ts b/lib/typescript/debugHelper/index.d.ts deleted file mode 100644 index 3d20405..0000000 --- a/lib/typescript/debugHelper/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export declare const DebugTouchPoint: ({ diameter, x, y, color, }: { - diameter?: number | undefined; - x?: number | undefined; - y?: number | undefined; - color?: string | undefined; -}) => JSX.Element; -export declare const DebugRect: ({ height, x, y, color, }: { - height: number; - x: number; - y: number; - color: string; -}) => JSX.Element; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/typescript/debugHelper/index.d.ts.map b/lib/typescript/debugHelper/index.d.ts.map deleted file mode 100644 index a2a282f..0000000 --- a/lib/typescript/debugHelper/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/debugHelper/index.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe;;;;;iBAuB3B,CAAC;AACF,eAAO,MAAM,SAAS;YAMZ,MAAM;OACX,MAAM;OACN,MAAM;WACF,MAAM;iBAkBd,CAAC"} \ No newline at end of file diff --git a/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts b/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts deleted file mode 100644 index 7503b33..0000000 --- a/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Calculates the new offset for the zoomSubject to ensure zoom center position is retained after zooming. - * Parameters should correspond to whether we need the offset for the X or Y axis - * - * ## Terms Used: - * - * - Zoom Subject: the view that's being zoomed and panned - * - Zoom Center: the point whose relative position to the window is retained - * - Unscaled: a measurement in pixels denoting the true size as observed by the users' eyes - * - Scaled: a measurement in pixels scaled to the "scale transformation" of the zoom subject to match with its true size. - * *For example:* - * If the scale on the zoom subject is 0.5, - * then to draw an actual 4px line on the zoom subject, we need to scale it to 4px / 0.5 = 8px - * 8px is the scaled measurement - * - * ## Overall idea of this algorithm: - * - * When users perform zooming by pinching the screen, - * we need to shift the zoom subject so that the position of the zoom center is always the same. - * The offset amount to shift the layer is the returned value. - * - * - * ## How we achieve our goal: - * - * To retain, the zoom center position, whenever a zoom action is performed, - * we just need to make sure the distances from all the points in the zoom subject - * to the zoom center increases or decreases by the growth rate of the scale. - * - * ``` - * newDistanceAnyPointToZoomCenter = oldDistanceAnyPointToZoomCenter * (newScale/oldScale) - * ``` - * - * We can't calculate that for all the points because there are unlimited points on a plain. - * However, due to the way `transform` works in RN, every point is scaled from the zoom subject center. - * Therefore, it's sufficient to base our calculation on the distance from the zoom subject center to the zoom center. - * - * ``` - * newDistanceZoomSubjectCenterToZoomCenter = oldDistanceZoomSubjectCenterToZoomCenter * (newScale/oldScale) - * ``` - * - * Once we have `newDistanceZoomSubjectCenterToZoomCenter`, - * we can easily calculate the position of the new center, which leads us to the offset amount. - * Refer to the code for more details - * - * @param oldOffsetXOrYScaled - * @param zoomSubjectOriginalWidthOrHeight - * @param oldScale - * @param newScale - * @param zoomCenterXOrY - */ -export declare function calcNewScaledOffsetForZoomCentering(oldOffsetXOrYScaled: number, zoomSubjectOriginalWidthOrHeight: number, oldScale: number, newScale: number, zoomCenterXOrY: number): number; -//# sourceMappingURL=calcNewScaledOffsetForZoomCentering.d.ts.map \ No newline at end of file diff --git a/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts.map b/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts.map deleted file mode 100644 index 4ffc3f5..0000000 --- a/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"calcNewScaledOffsetForZoomCentering.d.ts","sourceRoot":"","sources":["../../../src/helper/calcNewScaledOffsetForZoomCentering.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,mCAAmC,CACjD,mBAAmB,EAAE,MAAM,EAC3B,gCAAgC,EAAE,MAAM,EACxC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,UAyBvB"} \ No newline at end of file diff --git a/lib/typescript/helper/coordinateConversion.d.ts b/lib/typescript/helper/coordinateConversion.d.ts deleted file mode 100644 index c8bfdc0..0000000 --- a/lib/typescript/helper/coordinateConversion.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Size2D, Vec2D, ZoomableViewEvent } from 'src/typings'; -export declare const defaultTransformSubjectData: ZoomableViewEvent; -/** - * Assuming you have an image that's being resized to fit into a container - * using the "contain" resize mode. You can use this function to calculate the - * size of the image after fitting. - * - * Since our sheet is resized in this manner, we need this function - * for things like pan boundaries and marker placement - * - * @param imgSize - * @param containerSize - */ -export declare function applyContainResizeMode(imgSize: Size2D, containerSize: Size2D): { - size: Size2D; - scale: number; -} | { - size: null; - scale: null; -}; -/** - * get the coord of image's origin relative to the transformSubject - * @param resizedImageSize - * @param transformSubject - */ -export declare function getImageOriginOnTransformSubject(resizedImageSize: Size2D, transformSubject: ZoomableViewEvent): { - x: number; - y: number; -}; -/** - * Translates the coord system of a point from the viewport's space to the image's space - * - * @param pointOnContainer - * @param sheetImageSize - * @param transformSubject - * - * @return {Vec2D} returns null if point is out of the sheet's bound - */ -export declare function viewportPositionToImagePosition({ viewportPosition, imageSize, zoomableEvent, }: { - viewportPosition: Vec2D; - imageSize: Size2D; - zoomableEvent: ZoomableViewEvent; -}): Vec2D | null; -//# sourceMappingURL=coordinateConversion.d.ts.map \ No newline at end of file diff --git a/lib/typescript/helper/coordinateConversion.d.ts.map b/lib/typescript/helper/coordinateConversion.d.ts.map deleted file mode 100644 index c43dfee..0000000 --- a/lib/typescript/helper/coordinateConversion.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"coordinateConversion.d.ts","sourceRoot":"","sources":["../../../src/helper/coordinateConversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,2BAA2B,EAAE,iBAQzC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GACpB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,CA4B/D;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,iBAAiB;;;EAcpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAAC,EAC9C,gBAAgB,EAChB,SAAS,EACT,aAAa,GACd,EAAE;IACD,gBAAgB,EAAE,KAAK,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,iBAAiB,CAAC;CAClC,GAAG,KAAK,GAAG,IAAI,CA0Bf"} \ No newline at end of file diff --git a/lib/typescript/helper/index.d.ts b/lib/typescript/helper/index.d.ts deleted file mode 100644 index bc85ca3..0000000 --- a/lib/typescript/helper/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { GestureResponderEvent, PanResponderGestureState } from 'react-native'; -import { Vec2D } from '../typings'; -export { calcNewScaledOffsetForZoomCentering } from './calcNewScaledOffsetForZoomCentering'; -/** - * Calculates the gesture center point relative to the page coordinate system - * - * We're unable to use touch.locationX/Y - * because locationX uses the axis system of the leaf element that the touch occurs on, - * which makes it even more complicated to translate into our container's axis system. - * - * We're also unable to use gestureState.moveX/Y - * because gestureState.moveX/Y is messed up on real device - * (Sometimes it's the center point, but sometimes it randomly takes the position of one of the touches) - */ -export declare function calcGestureCenterPoint(e: GestureResponderEvent, gestureState: PanResponderGestureState): Vec2D | null; -export declare function calcGestureTouchDistance(e: GestureResponderEvent, gestureState: PanResponderGestureState): number | null; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/typescript/helper/index.d.ts.map b/lib/typescript/helper/index.d.ts.map deleted file mode 100644 index fe42758..0000000 --- a/lib/typescript/helper/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAE5F;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,qBAAqB,EACxB,YAAY,EAAE,wBAAwB,GACrC,KAAK,GAAG,IAAI,CAmBd;AAED,wBAAgB,wBAAwB,CACtC,CAAC,EAAE,qBAAqB,EACxB,YAAY,EAAE,wBAAwB,GACrC,MAAM,GAAG,IAAI,CAQf"} \ No newline at end of file diff --git a/lib/typescript/hooks/useLatestCallback.d.ts b/lib/typescript/hooks/useLatestCallback.d.ts deleted file mode 100644 index 3a1afed..0000000 --- a/lib/typescript/hooks/useLatestCallback.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * A hook that returns a stable callback reference that always calls the latest version of the function. - * This avoids the need to include the callback in dependency arrays while ensuring the latest version is called. - */ -export declare const useLatestCallback: (callback: (...args: Args) => Return) => (...args: Args) => Return; -//# sourceMappingURL=useLatestCallback.d.ts.map \ No newline at end of file diff --git a/lib/typescript/hooks/useLatestCallback.d.ts.map b/lib/typescript/hooks/useLatestCallback.d.ts.map deleted file mode 100644 index fd1ec86..0000000 --- a/lib/typescript/hooks/useLatestCallback.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"useLatestCallback.d.ts","sourceRoot":"","sources":["../../../src/hooks/useLatestCallback.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,oGAO7B,CAAC"} \ No newline at end of file diff --git a/lib/typescript/index.d.ts b/lib/typescript/index.d.ts deleted file mode 100644 index 7b02103..0000000 --- a/lib/typescript/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { applyContainResizeMode, getImageOriginOnTransformSubject, viewportPositionToImagePosition } from './helper/coordinateConversion'; -import ReactNativeZoomableView from './ReactNativeZoomableView'; -import type { ReactNativeZoomableViewProps, ZoomableViewEvent } from './typings'; -export { applyContainResizeMode, getImageOriginOnTransformSubject, ReactNativeZoomableView, ReactNativeZoomableViewProps, viewportPositionToImagePosition, ZoomableViewEvent, }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/typescript/index.d.ts.map b/lib/typescript/index.d.ts.map deleted file mode 100644 index 2a3655b..0000000 --- a/lib/typescript/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EACV,4BAA4B,EAC5B,iBAAiB,EAClB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAEL,sBAAsB,EACtB,gCAAgC,EAChC,uBAAuB,EACvB,4BAA4B,EAC5B,+BAA+B,EAC/B,iBAAiB,GAClB,CAAC"} \ No newline at end of file diff --git a/lib/typescript/typings/index.d.ts b/lib/typescript/typings/index.d.ts deleted file mode 100644 index 303e666..0000000 --- a/lib/typescript/typings/index.d.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { ReactNode } from 'react'; -import { Animated, GestureResponderEvent, LayoutChangeEvent, PanResponderGestureState, ViewProps } from 'react-native'; -export declare enum SwipeDirection { - SWIPE_UP = "SWIPE_UP", - SWIPE_DOWN = "SWIPE_DOWN", - SWIPE_LEFT = "SWIPE_LEFT", - SWIPE_RIGHT = "SWIPE_RIGHT" -} -export interface ZoomableViewEvent { - zoomLevel: number; - offsetX: number; - offsetY: number; - originalHeight: number; - originalWidth: number; - originalPageX: number; - originalPageY: number; -} -export interface ReactNativeZoomableViewProps { - style?: ViewProps['style']; - children?: ReactNode; - zoomEnabled?: boolean; - panEnabled?: boolean; - initialZoom?: number; - initialOffsetX?: number; - initialOffsetY?: number; - contentWidth?: number; - contentHeight?: number; - panBoundaryPadding?: number; - maxZoom?: number; - minZoom?: number; - doubleTapDelay?: number; - doubleTapZoomToCenter?: boolean; - zoomStep?: number; - pinchToZoomInSensitivity?: number; - pinchToZoomOutSensitivity?: number; - movementSensibility?: number; - longPressDuration?: number; - visualTouchFeedbackEnabled?: boolean; - disablePanOnInitialZoom?: boolean; - zoomAnimatedValue?: Animated.Value; - panAnimatedValueXY?: Animated.ValueXY; - debug?: boolean; - onLayout?: (event: Pick) => void; - onTransform?: (zoomableViewEventObject: ZoomableViewEvent) => void; - onSingleTap?: (event: GestureResponderEvent, zoomableViewEventObject: ZoomableViewEvent) => void; - onDoubleTapBefore?: (event: GestureResponderEvent, zoomableViewEventObject: ZoomableViewEvent) => void; - onDoubleTapAfter?: (event: GestureResponderEvent, zoomableViewEventObject: ZoomableViewEvent) => void; - onShiftingBefore?: (event: GestureResponderEvent | null, gestureState: PanResponderGestureState | null, zoomableViewEventObject: ZoomableViewEvent) => boolean; - onShiftingAfter?: (event: GestureResponderEvent | null, gestureState: PanResponderGestureState | null, zoomableViewEventObject: ZoomableViewEvent) => boolean; - onShiftingEnd?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => void; - onZoomBefore?: (event: GestureResponderEvent | null, gestureState: PanResponderGestureState | null, zoomableViewEventObject: ZoomableViewEvent) => boolean | undefined; - onZoomAfter?: (event: GestureResponderEvent | null, gestureState: PanResponderGestureState | null, zoomableViewEventObject: ZoomableViewEvent) => void; - onZoomEnd?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => void; - onLongPress?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => void; - onStartShouldSetPanResponder?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent, baseComponentResult: boolean) => boolean; - onPanResponderGrant?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => void; - onPanResponderEnd?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => void; - onPanResponderMove?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => boolean; - onPanResponderTerminate?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => void; - onPanResponderTerminationRequest?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => boolean; - onShouldBlockNativeResponder?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => boolean; - onStartShouldSetPanResponderCapture?: (event: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean; - onMoveShouldSetPanResponderCapture?: (event: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean; - onStaticPinPress?: (event: GestureResponderEvent) => void; - onStaticPinLongPress?: (event: GestureResponderEvent) => void; - staticPinPosition?: Vec2D; - staticPinIcon?: React.ReactElement; - onStaticPinPositionChange?: (position: Vec2D) => void; - onStaticPinPositionMove?: (position: Vec2D) => void; - pinProps?: ViewProps; -} -export interface Vec2D { - x: number; - y: number; -} -export interface Size2D { - width: number; - height: number; -} -export interface TouchPoint extends Vec2D { - id: string; - isSecondTap?: boolean; -} -export interface ReactNativeZoomableViewState { - touches?: TouchPoint[]; - originalWidth: number; - originalHeight: number; - originalPageX: number; - originalPageY: number; - originalX: number; - originalY: number; - debugPoints?: undefined | Vec2D[]; - pinSize: Size2D; -} -export interface ReactNativeZoomableViewWithGesturesProps extends ReactNativeZoomableViewProps { - swipeLengthThreshold?: number; - swipeVelocityThreshold?: number; - swipeDirectionalThreshold?: number; - swipeMinZoom?: number; - swipeMaxZoom?: number; - swipeDisabled?: boolean; - onSwipe?: (swipeDirection: SwipeDirection, gestureState: PanResponderGestureState) => void; - onSwipeUp?: (gestureState: PanResponderGestureState) => void; - onSwipeDown?: (gestureState: PanResponderGestureState) => void; - onSwipeLeft?: (gestureState: PanResponderGestureState) => void; - onSwipeRight?: (gestureState: PanResponderGestureState) => void; -} -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/typescript/typings/index.d.ts.map b/lib/typescript/typings/index.d.ts.map deleted file mode 100644 index dfc9f21..0000000 --- a/lib/typescript/typings/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/typings/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EACL,QAAQ,EACR,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,oBAAY,cAAc;IACxB,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,WAAW,gBAAgB;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,4BAA4B;IAE3C,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC3B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACr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;IAC/D,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,wBAAwB,KAAK,IAAI,CAAC;CACjE"} \ No newline at end of file diff --git a/package.json b/package.json index 3a16d85..6a5dba8 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,11 @@ "!**/__mocks__" ], "scripts": { + "prepublishOnly": "yarn build", "test": "jest", "typescript": "tsc --noEmit", "lint": "eslint \"**/*.{js,ts,tsx}\"", + "build": "bob build", "release": "release-it", "example": "yarn --cwd example", "pods": "cd example && pod-install --quiet", @@ -86,6 +88,7 @@ "typescript": "^4.9.5" }, "peerDependencies": { + "lodash": "^4.17.21", "react": ">=16.8.0", "react-native": ">=0.79.0" }, @@ -98,7 +101,7 @@ }, "husky": { "hooks": { - "pre-commit": "yarn lint && yarn typescript && bob build && git add lib" + "pre-commit": "yarn lint && yarn typescript" } }, "commitlint": { @@ -112,7 +115,7 @@ "tagName": "v${version}" }, "npm": { - "publish": true + "publish": false }, "github": { "release": true diff --git a/src/ReactNativeZoomableView.tsx b/src/ReactNativeZoomableView.tsx index 12ccae4..b517c88 100644 --- a/src/ReactNativeZoomableView.tsx +++ b/src/ReactNativeZoomableView.tsx @@ -1,5 +1,13 @@ -import { debounce } from 'lodash'; -import React, { Component, createRef, RefObject } from 'react'; +import { debounce, defaults } from 'lodash'; +import React, { + ForwardRefRenderFunction, + useEffect, + useImperativeHandle, + useLayoutEffect, + useMemo, + useRef, + useState, +} from 'react'; import { Animated, GestureResponderEvent, @@ -21,34 +29,42 @@ import { calcNewScaledOffsetForZoomCentering, } from './helper'; import { viewportPositionToImagePosition } from './helper/coordinateConversion'; +import { useLatestCallback } from './hooks/useLatestCallback'; import { ReactNativeZoomableViewProps, - ReactNativeZoomableViewState, - Size2D, TouchPoint, Vec2D, ZoomableViewEvent, } from './typings'; -const initialState: ReactNativeZoomableViewState = { - originalWidth: 0, - originalHeight: 0, - originalPageX: 0, - originalPageY: 0, - originalX: 0, - originalY: 0, - pinSize: { width: 0, height: 0 }, +type ReactNativeZoomableView = { + moveTo(newOffsetX: number, newOffsetY: number): void; + moveBy(offsetChangeX: number, offsetChangeY: number): void; + zoomTo(newZoomLevel: number, zoomCenter?: Vec2D): boolean; + zoomBy(zoomLevelChange: number): boolean; + moveStaticPinTo: (position: Vec2D, duration?: number) => void; + readonly gestureStarted: boolean; }; -class ReactNativeZoomableView extends Component< - ReactNativeZoomableViewProps, - ReactNativeZoomableViewState -> { - zoomSubjectWrapperRef: RefObject; - gestureHandlers: PanResponderInstance; - doubleTapFirstTapReleaseTimestamp: number | undefined; - - static defaultProps = { +const ReactNativeZoomableView: ForwardRefRenderFunction< + ReactNativeZoomableView, + ReactNativeZoomableViewProps +> = (props, ref) => { + const [originalWidth, setOriginalWidth] = useState(0); + const [originalHeight, setOriginalHeight] = useState(0); + const [originalPageX, setOriginalPageX] = useState(0); + const [originalPageY, setOriginalPageY] = useState(0); + const [originalX, setOriginalX] = useState(0); + const [originalY, setOriginalY] = useState(0); + const [pinSize, setPinSize] = useState({ width: 0, height: 0 }); + const [debugPoints, setDebugPoints] = useState([]); + const [stateTouches, setStateTouches] = useState([]); + + const zoomSubjectWrapperRef = useRef(null); + const gestureHandlers = useRef(); + const doubleTapFirstTapReleaseTimestamp = useRef(); + + props = defaults({}, props, { zoomEnabled: true, panEnabled: true, initialZoom: 1, @@ -61,7 +77,7 @@ class ReactNativeZoomableView extends Component< movementSensibility: 1, doubleTapDelay: 300, zoomStep: 0.5, - onLongPress: null, + onLongPress: undefined, longPressDuration: 700, contentWidth: undefined, contentHeight: undefined, @@ -71,51 +87,39 @@ class ReactNativeZoomableView extends Component< onStaticPinPositionChange: undefined, onStaticPinPositionMove: undefined, disablePanOnInitialZoom: false, - }; - - private panAnim = new Animated.ValueXY({ x: 0, y: 0 }); - private readonly zoomAnim = new Animated.Value(1); + }); - private offsetX = 0; - private offsetY = 0; + const panAnim = useRef(new Animated.ValueXY({ x: 0, y: 0 })); + const zoomAnim = useRef(new Animated.Value(1)); - private zoomLevel = 1; - private lastGestureCenterPosition: { x: number; y: number } | null = null; - private lastGestureTouchDistance: number | null = null; - private gestureType: 'pinch' | 'shift' | null; + const offsetX = useRef(0); + const offsetY = useRef(0); - private _gestureStarted = false; - private set gestureStarted(v: boolean) { - this._gestureStarted = v; - } + const zoomLevel = useRef(1); + const lastGestureCenterPosition = useRef<{ x: number; y: number } | null>( + null + ); + const lastGestureTouchDistance = useRef(150); + const gestureType = useRef<'pinch' | 'shift'>(); - public get gestureStarted() { - return this._gestureStarted; - } + const gestureStarted = useRef(false); /** * Last press time (used to evaluate whether user double tapped) - * @type {number} */ - private longPressTimeout: NodeJS.Timeout | null = null; - private onTransformInvocationInitialized: boolean | undefined; - private singleTapTimeoutId: NodeJS.Timeout | undefined; - private touches: TouchPoint[] = []; - private doubleTapFirstTap: TouchPoint | undefined; - private measureZoomSubjectInterval: NodeJS.Timer | undefined; - - constructor(props: ReactNativeZoomableViewProps) { - super(props); - // This needs to be done before anything else to initialize the state. - // Otherwise, the logic below may reference the state when it's undefined, - // causing runtime errors. - this.state = { ...initialState }; - - this.gestureHandlers = PanResponder.create({ - onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder, - onPanResponderGrant: this._handlePanResponderGrant, - onPanResponderMove: this._handlePanResponderMove, - onPanResponderRelease: this._handlePanResponderEnd, + const longPressTimeout = useRef(); + const onTransformInvocationInitialized = useRef(); + const singleTapTimeoutId = useRef(); + const touches = useRef([]); + const doubleTapFirstTap = useRef(); + const measureZoomSubjectInterval = useRef(); + + useLayoutEffect(() => { + gestureHandlers.current = PanResponder.create({ + onStartShouldSetPanResponder: _handleStartShouldSetPanResponder, + onPanResponderGrant: _handlePanResponderGrant, + onPanResponderMove: _handlePanResponderMove, + onPanResponderRelease: _handlePanResponderEnd, onPanResponderTerminate: (evt, gestureState) => { // We should also call _handlePanResponderEnd // to properly perform cleanups when the gesture is terminated @@ -123,114 +127,108 @@ class ReactNativeZoomableView extends Component< // This also fixes a weird issue where // on real device, sometimes onPanResponderRelease is not called when you lift 2 fingers up, // but onPanResponderTerminate is called instead for no apparent reason. - this._handlePanResponderEnd(evt, gestureState); - this.props.onPanResponderTerminate?.( + _handlePanResponderEnd(evt, gestureState); + props.onPanResponderTerminate?.( evt, gestureState, - this._getZoomableViewEventObject() + _getZoomableViewEventObject() ); }, onPanResponderTerminationRequest: (evt, gestureState) => - !!this.props.onPanResponderTerminationRequest?.( + !!props.onPanResponderTerminationRequest?.( evt, gestureState, - this._getZoomableViewEventObject() + _getZoomableViewEventObject() ), // Defaults to true to prevent parent components, such as React Navigation's tab view, from taking over as responder. onShouldBlockNativeResponder: (evt, gestureState) => - this.props.onShouldBlockNativeResponder?.( + props.onShouldBlockNativeResponder?.( evt, gestureState, - this._getZoomableViewEventObject() + _getZoomableViewEventObject() ) ?? true, onStartShouldSetPanResponderCapture: (evt, gestureState) => - !!this.props.onStartShouldSetPanResponderCapture?.(evt, gestureState), + !!props.onStartShouldSetPanResponderCapture?.(evt, gestureState), onMoveShouldSetPanResponderCapture: (evt, gestureState) => - !!this.props.onMoveShouldSetPanResponderCapture?.(evt, gestureState), + !!props.onMoveShouldSetPanResponderCapture?.(evt, gestureState), }); - this.zoomSubjectWrapperRef = createRef(); - - if (this.props.zoomAnimatedValue) - this.zoomAnim = this.props.zoomAnimatedValue; - if (this.props.panAnimatedValueXY) - this.panAnim = this.props.panAnimatedValueXY; + if (props.zoomAnimatedValue) zoomAnim.current = props.zoomAnimatedValue; + if (props.panAnimatedValueXY) panAnim.current = props.panAnimatedValueXY; - if (this.props.initialZoom) this.zoomLevel = this.props.initialZoom; - if (this.props.initialOffsetX != null) - this.offsetX = this.props.initialOffsetX; - if (this.props.initialOffsetY != null) - this.offsetY = this.props.initialOffsetY; + if (props.initialZoom) zoomLevel.current = props.initialZoom; + if (props.initialOffsetX != null) offsetX.current = props.initialOffsetX; + if (props.initialOffsetY != null) offsetY.current = props.initialOffsetY; - this.panAnim.setValue({ x: this.offsetX, y: this.offsetY }); - this.zoomAnim.setValue(this.zoomLevel); - this.panAnim.addListener(({ x, y }) => { - this.offsetX = x; - this.offsetY = y; + panAnim.current.setValue({ x: offsetX.current, y: offsetY.current }); + zoomAnim.current.setValue(zoomLevel.current); + panAnim.current.addListener(({ x, y }) => { + offsetX.current = x; + offsetY.current = y; }); - this.zoomAnim.addListener(({ value }) => { - this.zoomLevel = value; + zoomAnim.current.addListener(({ value }) => { + zoomLevel.current = value; }); - - this.lastGestureTouchDistance = 150; - - this.gestureType = null; - } - - componentDidUpdate( - prevProps: ReactNativeZoomableViewProps, - prevState: ReactNativeZoomableViewState - ) { - const { zoomEnabled, initialZoom } = this.props; - if (prevProps.zoomEnabled && !zoomEnabled && initialZoom) { - this.zoomLevel = initialZoom; - this.zoomAnim.setValue(this.zoomLevel); - } - if ( - !this.onTransformInvocationInitialized && - this._invokeOnTransform().successful - ) { - this.panAnim.addListener(() => this._invokeOnTransform()); - this.zoomAnim.addListener(() => this._invokeOnTransform()); - this.onTransformInvocationInitialized = true; + }, []); + + const { zoomEnabled } = props; + const initialZoom = useRef(props.initialZoom); + initialZoom.current = props.initialZoom; + useLayoutEffect(() => { + if (!zoomEnabled && initialZoom.current) { + zoomLevel.current = initialZoom.current; + zoomAnim.current.setValue(zoomLevel.current); } + }, [zoomEnabled]); - const currState = this.state; - const originalMeasurementsChanged = - currState.originalHeight !== prevState.originalHeight || - currState.originalWidth !== prevState.originalWidth || - currState.originalPageX !== prevState.originalPageX || - currState.originalPageY !== prevState.originalPageY || - currState.originalX !== prevState.originalX || - currState.originalY !== prevState.originalY; + useLayoutEffect( + () => { + if ( + !onTransformInvocationInitialized.current && + _invokeOnTransform().successful + ) { + panAnim.current.addListener(() => _invokeOnTransform()); + zoomAnim.current.addListener(() => _invokeOnTransform()); + onTransformInvocationInitialized.current = true; + } + }, + // FIXME: deps has implicit coupling with internal _invokeOnTransform logic + [originalWidth, originalHeight] + ); - const staticPinPositionChanged = - prevProps.staticPinPosition?.x !== this.props.staticPinPosition?.x || - prevProps.staticPinPosition?.y !== this.props.staticPinPosition?.y; + const onLayout = useRef(props.onLayout); + onLayout.current = props.onLayout; + // Handle original measurements changed + useLayoutEffect(() => { // We use a custom `onLayout` event, so the clients can stay in-sync // with when the internal measurements are actually saved to the state, // thus helping them apply transformations at more accurate timings - if (originalMeasurementsChanged) { - const layout = { - width: currState.originalWidth, - height: currState.originalHeight, - x: currState.originalX, - y: currState.originalY, - }; - this.props.onLayout?.({ nativeEvent: { layout } }); - } - - if ( - this.onTransformInvocationInitialized && - (originalMeasurementsChanged || staticPinPositionChanged) - ) { - this._invokeOnTransform(); - } - } - - componentDidMount() { - this.measureZoomSubject(); + const layout = { + width: originalWidth, + height: originalHeight, + x: originalX, + y: originalY, + }; + onLayout.current?.({ nativeEvent: { layout } }); + + if (onTransformInvocationInitialized.current) _invokeOnTransform(); + }, [ + originalHeight, + originalWidth, + originalPageX, + originalPageY, + originalX, + originalY, + ]); + + // Handle staticPinPosition changed + useLayoutEffect(() => { + if (onTransformInvocationInitialized.current) _invokeOnTransform(); + }, [props.staticPinPosition?.x, props.staticPinPosition?.y]); + + useEffect(() => { + measureZoomSubject(); // We've already run `grabZoomSubjectOriginalMeasurements` at various events // to make sure the measurements are promptly updated. // However, there might be cases we haven't accounted for, especially when @@ -238,39 +236,43 @@ class ReactNativeZoomableView extends Component< // we'll use an interval here to ensure we're always up-to-date. // The `setState` in `grabZoomSubjectOriginalMeasurements` won't trigger a rerender // if the values given haven't changed, so we're not running performance risk here. - this.measureZoomSubjectInterval = setInterval(this.measureZoomSubject, 1e3); - } + measureZoomSubjectInterval.current = setInterval(measureZoomSubject, 1e3); + + return () => { + measureZoomSubjectInterval.current && + clearInterval(measureZoomSubjectInterval.current); + }; + }, []); - componentWillUnmount() { - this.measureZoomSubjectInterval && - clearInterval(this.measureZoomSubjectInterval); - } + const onStaticPinPositionChange = useLatestCallback( + props.onStaticPinPositionChange || (() => undefined) + ); - debouncedOnStaticPinPositionChange = debounce( - (position: Vec2D) => this.props.onStaticPinPositionChange?.(position), - 100 + const debouncedOnStaticPinPositionChange = useMemo( + () => debounce(onStaticPinPositionChange, 100), + [] ); /** * try to invoke onTransform * @private */ - _invokeOnTransform() { - const zoomableViewEvent = this._getZoomableViewEventObject(); - const position = this._staticPinPosition(); + const _invokeOnTransform = useLatestCallback(() => { + const zoomableViewEvent = _getZoomableViewEventObject(); + const position = _staticPinPosition(); if (!zoomableViewEvent.originalWidth || !zoomableViewEvent.originalHeight) return { successful: false }; - this.props.onTransform?.(zoomableViewEvent); + props.onTransform?.(zoomableViewEvent); if (position) { - this.props.onStaticPinPositionMove?.(position); - this.debouncedOnStaticPinPositionChange(position); + props.onStaticPinPositionMove?.(position); + debouncedOnStaticPinPositionChange(position); } return { successful: true }; - } + }); /** * Returns additional information about components current state for external event hooks @@ -278,18 +280,20 @@ class ReactNativeZoomableView extends Component< * @returns {{}} * @private */ - _getZoomableViewEventObject(overwriteObj = {}): ZoomableViewEvent { - return { - zoomLevel: this.zoomLevel, - offsetX: this.offsetX, - offsetY: this.offsetY, - originalHeight: this.state.originalHeight, - originalWidth: this.state.originalWidth, - originalPageX: this.state.originalPageX, - originalPageY: this.state.originalPageY, - ...overwriteObj, - } as ZoomableViewEvent; - } + const _getZoomableViewEventObject = useLatestCallback( + (overwriteObj: Partial = {}): ZoomableViewEvent => { + return { + zoomLevel: zoomLevel.current, + offsetX: offsetX.current, + offsetY: offsetY.current, + originalHeight, + originalWidth, + originalPageX, + originalPageY, + ...overwriteObj, + }; + } + ); /** * Get the original box dimensions and save them for later use. @@ -297,7 +301,7 @@ class ReactNativeZoomableView extends Component< * * @private */ - private measureZoomSubject = () => { + const measureZoomSubject = useLatestCallback(() => { // make sure we measure after animations are complete requestAnimationFrame(() => { // this setTimeout is here to fix a weird issue on iOS where the measurements are all `0` @@ -309,39 +313,24 @@ class ReactNativeZoomableView extends Component< // in which case these measurements will not represent the true "original" measurements. // We just need to make sure the zoomSubjectWrapper perfectly aligns with the zoomSubject // (no border, space, or anything between them) - this.zoomSubjectWrapperRef.current?.measure( + zoomSubjectWrapperRef.current?.measure( (x, y, width, height, pageX, pageY) => { // When the component is off-screen, these become all 0s, so we don't set them // to avoid messing up calculations, especially ones that are done right after // the component transitions from hidden to visible. if (!pageX && !pageY && !width && !height) return; - // If these values are all the same, don't re-set them in state - // this way we don't re-render - if ( - this.state.originalX === x && - this.state.originalY === y && - this.state.originalWidth === width && - this.state.originalHeight === height && - this.state.originalPageX === pageX && - this.state.originalPageY === pageY - ) { - return; - } - - this.setState({ - originalX: x, - originalY: y, - originalWidth: width, - originalHeight: height, - originalPageX: pageX, - originalPageY: pageY, - }); + setOriginalX(x); + setOriginalY(y); + setOriginalWidth(width); + setOriginalHeight(height); + setOriginalPageX(pageX); + setOriginalPageY(pageY); } ); }); }); - }; + }); /** * Handles the start of touch events and checks for taps @@ -352,25 +341,24 @@ class ReactNativeZoomableView extends Component< * * @private */ - _handleStartShouldSetPanResponder = ( - e: GestureResponderEvent, - gestureState: PanResponderGestureState - ) => { - if (this.props.onStartShouldSetPanResponder) { - this.props.onStartShouldSetPanResponder( - e, - gestureState, - this._getZoomableViewEventObject(), - false - ); - } + const _handleStartShouldSetPanResponder = useLatestCallback( + (e: GestureResponderEvent, gestureState: PanResponderGestureState) => { + if (props.onStartShouldSetPanResponder) { + props.onStartShouldSetPanResponder( + e, + gestureState, + _getZoomableViewEventObject(), + false + ); + } - // Always set pan responder on start - // of gesture so we can handle tap. - // "Pan threshold validation" will be handled - // in `onPanResponderMove` instead of in `onMoveShouldSetPanResponder` - return true; - }; + // Always set pan responder on start + // of gesture so we can handle tap. + // "Pan threshold validation" will be handled + // in `onPanResponderMove` instead of in `onMoveShouldSetPanResponder` + return true; + } + ); /** * Calculates pinch distance @@ -379,31 +367,23 @@ class ReactNativeZoomableView extends Component< * @param gestureState * @private */ - _handlePanResponderGrant: NonNullable< + const _handlePanResponderGrant: NonNullable< PanResponderCallbacks['onPanResponderGrant'] - > = (e, gestureState) => { - if (this.props.onLongPress) { + > = useLatestCallback((e, gestureState) => { + if (props.onLongPress) { e.persist(); - this.longPressTimeout = setTimeout(() => { - this.props.onLongPress?.( - e, - gestureState, - this._getZoomableViewEventObject() - ); - this.longPressTimeout = null; - }, this.props.longPressDuration); + longPressTimeout.current = setTimeout(() => { + props.onLongPress?.(e, gestureState, _getZoomableViewEventObject()); + longPressTimeout.current = undefined; + }, props.longPressDuration); } - this.props.onPanResponderGrant?.( - e, - gestureState, - this._getZoomableViewEventObject() - ); + props.onPanResponderGrant?.(e, gestureState, _getZoomableViewEventObject()); - this.panAnim.stopAnimation(); - this.zoomAnim.stopAnimation(); - this.gestureStarted = true; - }; + panAnim.current.stopAnimation(); + zoomAnim.current.stopAnimation(); + gestureStarted.current = true; + }); /** * Handles the end of touch events @@ -413,49 +393,37 @@ class ReactNativeZoomableView extends Component< * * @private */ - _handlePanResponderEnd: NonNullable< + const _handlePanResponderEnd: NonNullable< PanResponderCallbacks['onPanResponderEnd'] - > = (e, gestureState) => { - if (!this.gestureType) { - this._resolveAndHandleTap(e); + > = useLatestCallback((e, gestureState) => { + if (!gestureType.current) { + _resolveAndHandleTap(e); } - this.setState({ debugPoints: [] }); + setDebugPoints([]); - this.lastGestureCenterPosition = null; + lastGestureCenterPosition.current = null; - if (this.longPressTimeout) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; + if (longPressTimeout.current) { + clearTimeout(longPressTimeout.current); + longPressTimeout.current = undefined; } - this.props.onPanResponderEnd?.( - e, - gestureState, - this._getZoomableViewEventObject() - ); + props.onPanResponderEnd?.(e, gestureState, _getZoomableViewEventObject()); - if (this.gestureType === 'pinch') { - this.props.onZoomEnd?.( - e, - gestureState, - this._getZoomableViewEventObject() - ); - } else if (this.gestureType === 'shift') { - this.props.onShiftingEnd?.( - e, - gestureState, - this._getZoomableViewEventObject() - ); + if (gestureType.current === 'pinch') { + props.onZoomEnd?.(e, gestureState, _getZoomableViewEventObject()); + } else if (gestureType.current === 'shift') { + props.onShiftingEnd?.(e, gestureState, _getZoomableViewEventObject()); } - if (this.props.staticPinPosition) { - this._updateStaticPin(); + if (props.staticPinPosition) { + _updateStaticPin(); } - this.gestureType = null; - this.gestureStarted = false; - }; + gestureType.current = undefined; + gestureStarted.current = false; + }); /** * Handles the actual movement of our pan responder @@ -465,78 +433,77 @@ class ReactNativeZoomableView extends Component< * * @private */ - _handlePanResponderMove = ( - e: GestureResponderEvent, - gestureState: PanResponderGestureState - ) => { - if (this.props.onPanResponderMove) { - if ( - this.props.onPanResponderMove( - e, - gestureState, - this._getZoomableViewEventObject() - ) - ) { - return false; + const _handlePanResponderMove = useLatestCallback( + (e: GestureResponderEvent, gestureState: PanResponderGestureState) => { + if (props.onPanResponderMove) { + if ( + props.onPanResponderMove( + e, + gestureState, + _getZoomableViewEventObject() + ) + ) { + return false; + } } - } - // Only supports 2 touches and below, - // any invalid number will cause the gesture to end. - if (gestureState.numberActiveTouches <= 2) { - if (!this.gestureStarted) { - this._handlePanResponderGrant(e, gestureState); - } - } else { - if (this.gestureStarted) { - this._handlePanResponderEnd(e, gestureState); + // Only supports 2 touches and below, + // any invalid number will cause the gesture to end. + if (gestureState.numberActiveTouches <= 2) { + if (!gestureStarted.current) { + _handlePanResponderGrant(e, gestureState); + } + } else { + if (gestureStarted.current) { + _handlePanResponderEnd(e, gestureState); + } + return true; } - return true; - } - if (gestureState.numberActiveTouches === 2) { - if (this.longPressTimeout) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } + if (gestureState.numberActiveTouches === 2) { + if (longPressTimeout.current) { + clearTimeout(longPressTimeout.current); + longPressTimeout.current = undefined; + } - // change some measurement states when switching gesture to ensure a smooth transition - if (this.gestureType !== 'pinch') { - this.lastGestureCenterPosition = calcGestureCenterPoint( - e, - gestureState - ); - this.lastGestureTouchDistance = calcGestureTouchDistance( - e, - gestureState - ); - } - this.gestureType = 'pinch'; - this._handlePinching(e, gestureState); - } else if (gestureState.numberActiveTouches === 1) { - if ( - this.longPressTimeout && - (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5) - ) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } - // change some measurement states when switching gesture to ensure a smooth transition - if (this.gestureType !== 'shift') { - this.lastGestureCenterPosition = calcGestureCenterPoint( - e, - gestureState - ); - } + // change some measurement states when switching gesture to ensure a smooth transition + if (gestureType.current !== 'pinch') { + lastGestureCenterPosition.current = calcGestureCenterPoint( + e, + gestureState + ); + lastGestureTouchDistance.current = calcGestureTouchDistance( + e, + gestureState + ); + } + gestureType.current = 'pinch'; + _handlePinching(e, gestureState); + } else if (gestureState.numberActiveTouches === 1) { + if ( + longPressTimeout.current && + (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5) + ) { + clearTimeout(longPressTimeout.current); + longPressTimeout.current = undefined; + } + // change some measurement states when switching gesture to ensure a smooth transition + if (gestureType.current !== 'shift') { + lastGestureCenterPosition.current = calcGestureCenterPoint( + e, + gestureState + ); + } - const { dx, dy } = gestureState; - const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2; - if (isShiftGesture) { - this.gestureType = 'shift'; - this._handleShifting(gestureState); + const { dx, dy } = gestureState; + const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2; + if (isShiftGesture) { + gestureType.current = 'shift'; + _handleShifting(gestureState); + } } } - }; + ); /** * Handles the pinch movement and zooming @@ -546,128 +513,118 @@ class ReactNativeZoomableView extends Component< * * @private */ - _handlePinching( - e: GestureResponderEvent, - gestureState: PanResponderGestureState - ) { - if (!this.props.zoomEnabled) return; + const _handlePinching = useLatestCallback( + (e: GestureResponderEvent, gestureState: PanResponderGestureState) => { + if (!props.zoomEnabled) return; - const { - maxZoom, - minZoom, - pinchToZoomInSensitivity, - pinchToZoomOutSensitivity, - } = this.props; + const { + maxZoom, + minZoom, + pinchToZoomInSensitivity, + pinchToZoomOutSensitivity, + } = props; - const distance = calcGestureTouchDistance(e, gestureState); + const distance = calcGestureTouchDistance(e, gestureState); - if ( - this.props.onZoomBefore && - this.props.onZoomBefore( - e, - gestureState, - this._getZoomableViewEventObject() - ) - ) { - return; - } - - if (!distance) return; - if (!this.lastGestureTouchDistance) return; + if ( + props.onZoomBefore && + props.onZoomBefore(e, gestureState, _getZoomableViewEventObject()) + ) { + return; + } - // define the new zoom level and take zoom level sensitivity into consideration - const zoomGrowthFromLastGestureState = - distance / this.lastGestureTouchDistance; - this.lastGestureTouchDistance = distance; + if (!distance) return; + if (!lastGestureTouchDistance.current) return; - const pinchToZoomSensitivity = - zoomGrowthFromLastGestureState < 1 - ? pinchToZoomOutSensitivity - : pinchToZoomInSensitivity; + // define the new zoom level and take zoom level sensitivity into consideration + const zoomGrowthFromLastGestureState = + distance / lastGestureTouchDistance.current; + lastGestureTouchDistance.current = distance; - if (pinchToZoomSensitivity == null) return; - const deltaGrowth = zoomGrowthFromLastGestureState - 1; - // 0 - no resistance - // 10 - 90% resistance - const deltaGrowthAdjustedBySensitivity = - deltaGrowth * (1 - (pinchToZoomSensitivity * 9) / 100); + const pinchToZoomSensitivity = + zoomGrowthFromLastGestureState < 1 + ? pinchToZoomOutSensitivity + : pinchToZoomInSensitivity; - let newZoomLevel = this.zoomLevel * (1 + deltaGrowthAdjustedBySensitivity); + if (pinchToZoomSensitivity == null) return; + const deltaGrowth = zoomGrowthFromLastGestureState - 1; + // 0 - no resistance + // 10 - 90% resistance + const deltaGrowthAdjustedBySensitivity = + deltaGrowth * (1 - (pinchToZoomSensitivity * 9) / 100); - // make sure max and min zoom levels are respected - if (maxZoom != null && newZoomLevel > maxZoom) { - newZoomLevel = maxZoom; - } + let newZoomLevel = + zoomLevel.current * (1 + deltaGrowthAdjustedBySensitivity); - if (minZoom != null && newZoomLevel < minZoom) { - newZoomLevel = minZoom; - } + // make sure max and min zoom levels are respected + if (maxZoom != null && newZoomLevel > maxZoom) { + newZoomLevel = maxZoom; + } - const gestureCenterPoint = calcGestureCenterPoint(e, gestureState); + if (minZoom != null && newZoomLevel < minZoom) { + newZoomLevel = minZoom; + } - if (!gestureCenterPoint) return; + const gestureCenterPoint = calcGestureCenterPoint(e, gestureState); - let zoomCenter = { - x: gestureCenterPoint.x - this.state.originalPageX, - y: gestureCenterPoint.y - this.state.originalPageY, - }; + if (!gestureCenterPoint) return; - if (this.props.staticPinPosition) { - // When we use a static pin position, the zoom centre is the same as that position, - // otherwise the pin moves around way too much while zooming. - zoomCenter = { - x: this.props.staticPinPosition.x, - y: this.props.staticPinPosition.y, + let zoomCenter = { + x: gestureCenterPoint.x - originalPageX, + y: gestureCenterPoint.y - originalPageY, }; - } - // Uncomment to debug - this.props.debug && this._setPinchDebugPoints(e, zoomCenter); + if (props.staticPinPosition) { + // When we use a static pin position, the zoom centre is the same as that position, + // otherwise the pin moves around way too much while zooming. + zoomCenter = { + x: props.staticPinPosition.x, + y: props.staticPinPosition.y, + }; + } - const { originalHeight, originalWidth } = this.state; + // Uncomment to debug + props.debug && _setPinchDebugPoints(e, zoomCenter); - const oldOffsetX = this.offsetX; - const oldOffsetY = this.offsetY; - const oldScale = this.zoomLevel; - const newScale = newZoomLevel; + const oldOffsetX = offsetX.current; + const oldOffsetY = offsetY.current; + const oldScale = zoomLevel.current; + const newScale = newZoomLevel; - if (!originalHeight || !originalWidth) return; + if (!originalHeight || !originalWidth) return; - let offsetY = calcNewScaledOffsetForZoomCentering( - oldOffsetY, - originalHeight, - oldScale, - newScale, - zoomCenter.y - ); - let offsetX = calcNewScaledOffsetForZoomCentering( - oldOffsetX, - originalWidth, - oldScale, - newScale, - zoomCenter.x - ); + let newOffsetY = calcNewScaledOffsetForZoomCentering( + oldOffsetY, + originalHeight, + oldScale, + newScale, + zoomCenter.y + ); + let newOffsetX = calcNewScaledOffsetForZoomCentering( + oldOffsetX, + originalWidth, + oldScale, + newScale, + zoomCenter.x + ); - const offsetShift = - this._calcOffsetShiftSinceLastGestureState(gestureCenterPoint); - if (offsetShift) { - offsetX += offsetShift.x; - offsetY += offsetShift.y; - } + const offsetShift = + _calcOffsetShiftSinceLastGestureState(gestureCenterPoint); + if (offsetShift) { + newOffsetX += offsetShift.x; + newOffsetY += offsetShift.y; + } - this.offsetX = offsetX; - this.offsetY = offsetY; - this.zoomLevel = newScale; + offsetX.current = newOffsetX; + offsetY.current = newOffsetY; + zoomLevel.current = newScale; - this.panAnim.setValue({ x: this.offsetX, y: this.offsetY }); - this.zoomAnim.setValue(this.zoomLevel); + panAnim.current.setValue({ x: offsetX.current, y: offsetY.current }); + zoomAnim.current.setValue(zoomLevel.current); - this.props.onZoomAfter?.( - e, - gestureState, - this._getZoomableViewEventObject() - ); - } + props.onZoomAfter?.(e, gestureState, _getZoomableViewEventObject()); + } + ); /** * Used to debug pinch events @@ -675,16 +632,15 @@ class ReactNativeZoomableView extends Component< * @param zoomCenter * @param points */ - _setPinchDebugPoints( - gestureResponderEvent: GestureResponderEvent, - zoomCenter: Vec2D, - ...points: Vec2D[] - ) { - const { touches } = gestureResponderEvent.nativeEvent; - const { originalPageY, originalPageX } = this.state; - - this.setState({ - debugPoints: [ + const _setPinchDebugPoints = useLatestCallback( + ( + gestureResponderEvent: GestureResponderEvent, + zoomCenter: Vec2D, + ...points: Vec2D[] + ) => { + const { touches } = gestureResponderEvent.nativeEvent; + + setDebugPoints([ { x: touches[0].pageX - originalPageX, y: touches[0].pageY - originalPageY, @@ -695,9 +651,9 @@ class ReactNativeZoomableView extends Component< }, zoomCenter, ...points, - ], - }); - } + ]); + } + ); /** * Calculates the amount the offset should shift since the last position during panning @@ -706,28 +662,30 @@ class ReactNativeZoomableView extends Component< * * @private */ - _calcOffsetShiftSinceLastGestureState(gestureCenterPoint: Vec2D) { - const { movementSensibility } = this.props; + const _calcOffsetShiftSinceLastGestureState = useLatestCallback( + (gestureCenterPoint: Vec2D) => { + const { movementSensibility } = props; - let shift = null; + let shift = null; - if (this.lastGestureCenterPosition && movementSensibility) { - const dx = gestureCenterPoint.x - this.lastGestureCenterPosition.x; - const dy = gestureCenterPoint.y - this.lastGestureCenterPosition.y; + if (lastGestureCenterPosition.current && movementSensibility) { + const dx = gestureCenterPoint.x - lastGestureCenterPosition.current.x; + const dy = gestureCenterPoint.y - lastGestureCenterPosition.current.y; - const shiftX = dx / this.zoomLevel / movementSensibility; - const shiftY = dy / this.zoomLevel / movementSensibility; + const shiftX = dx / zoomLevel.current / movementSensibility; + const shiftY = dy / zoomLevel.current / movementSensibility; - shift = { - x: shiftX, - y: shiftY, - }; - } + shift = { + x: shiftX, + y: shiftY, + }; + } - this.lastGestureCenterPosition = gestureCenterPoint; + lastGestureCenterPosition.current = gestureCenterPoint; - return shift; - } + return shift; + } + ); /** * Handles movement by tap and move @@ -736,36 +694,34 @@ class ReactNativeZoomableView extends Component< * * @private */ - _handleShifting(gestureState: PanResponderGestureState) { - // Skips shifting if panEnabled is false or disablePanOnInitialZoom is true and we're on the initial zoom level - if ( - !this.props.panEnabled || - (this.props.disablePanOnInitialZoom && - this.zoomLevel === this.props.initialZoom) - ) { - return; - } - const shift = this._calcOffsetShiftSinceLastGestureState({ - x: gestureState.moveX, - y: gestureState.moveY, - }); - if (!shift) return; + const _handleShifting = useLatestCallback( + (gestureState: PanResponderGestureState) => { + // Skips shifting if panEnabled is false or disablePanOnInitialZoom is true and we're on the initial zoom level + if ( + !props.panEnabled || + (props.disablePanOnInitialZoom && + zoomLevel.current === props.initialZoom) + ) { + return; + } + const shift = _calcOffsetShiftSinceLastGestureState({ + x: gestureState.moveX, + y: gestureState.moveY, + }); + if (!shift) return; - const offsetX = this.offsetX + shift.x; - const offsetY = this.offsetY + shift.y; + const newOffsetX = offsetX.current + shift.x; + const newOffsetY = offsetY.current + shift.y; - if ( - this.props.debug && - this.state.originalPageX && - this.state.originalPageY - ) { - const x = gestureState.moveX - this.state.originalPageX; - const y = gestureState.moveY - this.state.originalPageY; - this.setState({ debugPoints: [{ x, y }] }); - } + if (props.debug && originalPageX && originalPageY) { + const x = gestureState.moveX - originalPageX; + const y = gestureState.moveY - originalPageY; + setDebugPoints([{ x, y }]); + } - this._setNewOffsetPosition(offsetX, offsetY); - } + _setNewOffsetPosition(newOffsetX, newOffsetY); + } + ); /** * Set the state to offset moved @@ -774,21 +730,23 @@ class ReactNativeZoomableView extends Component< * @param {number} newOffsetY * @returns */ - _setNewOffsetPosition(newOffsetX: number, newOffsetY: number) { - const { onShiftingBefore, onShiftingAfter } = this.props; + const _setNewOffsetPosition = useLatestCallback( + (newOffsetX: number, newOffsetY: number) => { + const { onShiftingBefore, onShiftingAfter } = props; - if (onShiftingBefore?.(null, null, this._getZoomableViewEventObject())) { - return; - } + if (onShiftingBefore?.(null, null, _getZoomableViewEventObject())) { + return; + } - this.offsetX = newOffsetX; - this.offsetY = newOffsetY; + offsetX.current = newOffsetX; + offsetY.current = newOffsetY; - this.panAnim.setValue({ x: this.offsetX, y: this.offsetY }); - this.zoomAnim.setValue(this.zoomLevel); + panAnim.current.setValue({ x: offsetX.current, y: offsetY.current }); + zoomAnim.current.setValue(zoomLevel.current); - onShiftingAfter?.(null, null, this._getZoomableViewEventObject()); - } + onShiftingAfter?.(null, null, _getZoomableViewEventObject()); + } + ); /** * Check whether the press event is double tap @@ -798,126 +756,127 @@ class ReactNativeZoomableView extends Component< * * @private */ - private _resolveAndHandleTap = (e: GestureResponderEvent) => { + const _resolveAndHandleTap = useLatestCallback((e: GestureResponderEvent) => { const now = Date.now(); if ( - this.doubleTapFirstTapReleaseTimestamp && - this.props.doubleTapDelay && - now - this.doubleTapFirstTapReleaseTimestamp < this.props.doubleTapDelay + doubleTapFirstTapReleaseTimestamp.current && + props.doubleTapDelay && + now - doubleTapFirstTapReleaseTimestamp.current < props.doubleTapDelay ) { - this.doubleTapFirstTap && - this._addTouch({ - ...this.doubleTapFirstTap, + doubleTapFirstTap.current && + _addTouch({ + ...doubleTapFirstTap.current, id: now.toString(), isSecondTap: true, }); - this.singleTapTimeoutId && clearTimeout(this.singleTapTimeoutId); - delete this.doubleTapFirstTapReleaseTimestamp; - delete this.singleTapTimeoutId; - delete this.doubleTapFirstTap; - this._handleDoubleTap(e); + singleTapTimeoutId.current && clearTimeout(singleTapTimeoutId.current); + delete doubleTapFirstTapReleaseTimestamp.current; + delete singleTapTimeoutId.current; + delete doubleTapFirstTap.current; + _handleDoubleTap(e); } else { - this.doubleTapFirstTapReleaseTimestamp = now; - this.doubleTapFirstTap = { + doubleTapFirstTapReleaseTimestamp.current = now; + doubleTapFirstTap.current = { id: now.toString(), - x: e.nativeEvent.pageX - this.state.originalPageX, - y: e.nativeEvent.pageY - this.state.originalPageY, + x: e.nativeEvent.pageX - originalPageX, + y: e.nativeEvent.pageY - originalPageY, }; - this._addTouch(this.doubleTapFirstTap); + _addTouch(doubleTapFirstTap.current); // persist event so e.nativeEvent is preserved after a timeout delay e.persist(); - this.singleTapTimeoutId = setTimeout(() => { - delete this.doubleTapFirstTapReleaseTimestamp; - delete this.singleTapTimeoutId; + singleTapTimeoutId.current = setTimeout(() => { + delete doubleTapFirstTapReleaseTimestamp.current; + delete singleTapTimeoutId.current; // Pan to the tapped location - if (this.props.staticPinPosition && this.doubleTapFirstTap) { - const tapX = - this.props.staticPinPosition.x - this.doubleTapFirstTap.x; - const tapY = - this.props.staticPinPosition.y - this.doubleTapFirstTap.y; + if (props.staticPinPosition && doubleTapFirstTap.current) { + const tapX = props.staticPinPosition.x - doubleTapFirstTap.current.x; + const tapY = props.staticPinPosition.y - doubleTapFirstTap.current.y; - Animated.timing(this.panAnim, { + Animated.timing(panAnim.current, { toValue: { - x: this.offsetX + tapX / this.zoomLevel, - y: this.offsetY + tapY / this.zoomLevel, + x: offsetX.current + tapX / zoomLevel.current, + y: offsetY.current + tapY / zoomLevel.current, }, useNativeDriver: true, duration: 200, }).start(() => { - this._updateStaticPin(); + _updateStaticPin(); }); } - this.props.onSingleTap?.(e, this._getZoomableViewEventObject()); - }, this.props.doubleTapDelay); + props.onSingleTap?.(e, _getZoomableViewEventObject()); + }, props.doubleTapDelay); } - }; - - moveStaticPinTo = (position: Vec2D, duration?: number) => { - const { originalWidth, originalHeight } = this.state; - const { staticPinPosition, contentWidth, contentHeight } = this.props; - - if (!staticPinPosition) return; - if (!originalWidth || !originalHeight) return; - if (!contentWidth || !contentHeight) return; - - // Offset for the static pin - const pinX = staticPinPosition.x - originalWidth / 2; - const pinY = staticPinPosition.y - originalHeight / 2; - - this.offsetX = contentWidth / 2 - position.x + pinX / this.zoomLevel; - this.offsetY = contentHeight / 2 - position.y + pinY / this.zoomLevel; - - if (duration) { - Animated.timing(this.panAnim, { - toValue: { x: this.offsetX, y: this.offsetY }, - useNativeDriver: true, - duration, - }).start(); - } else { - this.panAnim.setValue({ x: this.offsetX, y: this.offsetY }); + }); + + const publicMoveStaticPinTo = useLatestCallback( + (position: Vec2D, duration?: number) => { + const { staticPinPosition, contentWidth, contentHeight } = props; + + if (!staticPinPosition) return; + if (!originalWidth || !originalHeight) return; + if (!contentWidth || !contentHeight) return; + + // Offset for the static pin + const pinX = staticPinPosition.x - originalWidth / 2; + const pinY = staticPinPosition.y - originalHeight / 2; + + offsetX.current = + contentWidth / 2 - position.x + pinX / zoomLevel.current; + offsetY.current = + contentHeight / 2 - position.y + pinY / zoomLevel.current; + + if (duration) { + Animated.timing(panAnim.current, { + toValue: { x: offsetX.current, y: offsetY.current }, + useNativeDriver: true, + duration, + }).start(); + } else { + panAnim.current.setValue({ x: offsetX.current, y: offsetY.current }); + } } - }; + ); - private _staticPinPosition = () => { - if (!this.props.staticPinPosition) return; - if (!this.props.contentWidth || !this.props.contentHeight) return; + const _staticPinPosition = useLatestCallback(() => { + if (!props.staticPinPosition) return; + if (!props.contentWidth || !props.contentHeight) return; return viewportPositionToImagePosition({ viewportPosition: { - x: this.props.staticPinPosition.x, - y: this.props.staticPinPosition.y, + x: props.staticPinPosition.x, + y: props.staticPinPosition.y, }, imageSize: { - height: this.props.contentHeight, - width: this.props.contentWidth, + height: props.contentHeight, + width: props.contentWidth, }, zoomableEvent: { - ...this._getZoomableViewEventObject(), - offsetX: this.offsetX, - offsetY: this.offsetY, - zoomLevel: this.zoomLevel, + ..._getZoomableViewEventObject(), + offsetX: offsetX.current, + offsetY: offsetY.current, + zoomLevel: zoomLevel.current, }, }); - }; + }); - private _updateStaticPin = () => { - const position = this._staticPinPosition(); + const _updateStaticPin = useLatestCallback(() => { + const position = _staticPinPosition(); if (!position) return; - this.props.onStaticPinPositionChange?.(position); - }; + props.onStaticPinPositionChange?.(position); + }); - private _addTouch(touch: TouchPoint) { - this.touches.push(touch); - this.setState({ touches: [...this.touches] }); - } + const _addTouch = useLatestCallback((touch: TouchPoint) => { + touches.current.push(touch); + setStateTouches([...touches.current]); + }); - private _removeTouch(touch: TouchPoint) { - this.touches.splice(this.touches.indexOf(touch), 1); - this.setState({ touches: [...this.touches] }); - } + const _removeTouch = useLatestCallback((touch: TouchPoint) => { + touches.current.splice(touches.current.indexOf(touch), 1); + setStateTouches([...touches.current]); + }); /** * Handles the double tap event @@ -926,17 +885,15 @@ class ReactNativeZoomableView extends Component< * * @private */ - _handleDoubleTap(e: GestureResponderEvent) { + const _handleDoubleTap = useLatestCallback((e: GestureResponderEvent) => { const { onDoubleTapBefore, onDoubleTapAfter, doubleTapZoomToCenter } = - this.props; + props; - onDoubleTapBefore?.(e, this._getZoomableViewEventObject()); + onDoubleTapBefore?.(e, _getZoomableViewEventObject()); - const nextZoomStep = this._getNextZoomStep(); + const nextZoomStep = _getNextZoomStep(); if (nextZoomStep == null) return; - const { originalPageX, originalPageY } = this.state; - // define new zoom position coordinates const zoomPositionCoordinates = { x: e.nativeEvent.pageX - originalPageX, @@ -949,13 +906,13 @@ class ReactNativeZoomableView extends Component< zoomPositionCoordinates.y = 0; } - this.zoomTo(nextZoomStep, zoomPositionCoordinates); + publicZoomTo(nextZoomStep, zoomPositionCoordinates); onDoubleTapAfter?.( e, - this._getZoomableViewEventObject({ zoomLevel: nextZoomStep }) + _getZoomableViewEventObject({ zoomLevel: nextZoomStep }) ); - } + }); /** * Returns the next zoom step based on current step and zoomStep property. @@ -963,25 +920,24 @@ class ReactNativeZoomableView extends Component< * * @returns {*} */ - _getNextZoomStep() { - const { zoomStep, maxZoom, initialZoom } = this.props; - const { zoomLevel } = this; + const _getNextZoomStep = useLatestCallback(() => { + const { zoomStep, maxZoom, initialZoom } = props; if (maxZoom == null) return; - if (zoomLevel.toFixed(2) === maxZoom.toFixed(2)) { + if (zoomLevel.current.toFixed(2) === maxZoom.toFixed(2)) { return initialZoom; } if (zoomStep == null) return; - const nextZoomStep = zoomLevel * (1 + zoomStep); + const nextZoomStep = zoomLevel.current * (1 + zoomStep); if (nextZoomStep > maxZoom) { return maxZoom; } return nextZoomStep; - } + }); /** * Zooms to a specific level. A "zoom center" can be provided, which specifies @@ -992,52 +948,54 @@ class ReactNativeZoomableView extends Component< * @param newZoomLevel * @param zoomCenter - If not supplied, the container's center is the zoom center */ - zoomTo(newZoomLevel: number, zoomCenter?: Vec2D) { - if (!this.props.zoomEnabled) return false; - if (this.props.maxZoom && newZoomLevel > this.props.maxZoom) return false; - if (this.props.minZoom && newZoomLevel < this.props.minZoom) return false; - - this.props.onZoomBefore?.(null, null, this._getZoomableViewEventObject()); - - // == Perform Pan Animation to preserve the zoom center while zooming == - let listenerId = ''; - if (zoomCenter) { - // Calculates panAnim values based on changes in zoomAnim. - let prevScale = this.zoomLevel; - // Since zoomAnim is calculated in native driver, - // it will jitter panAnim once in a while, - // because here panAnim is being calculated in js. - // However the jittering should mostly occur in simulator. - listenerId = this.zoomAnim.addListener(({ value: newScale }) => { - this.panAnim.setValue({ - x: calcNewScaledOffsetForZoomCentering( - this.offsetX, - this.state.originalWidth, - prevScale, - newScale, - zoomCenter.x - ), - y: calcNewScaledOffsetForZoomCentering( - this.offsetY, - this.state.originalHeight, - prevScale, - newScale, - zoomCenter.y - ), + const publicZoomTo = useLatestCallback( + (newZoomLevel: number, zoomCenter?: Vec2D) => { + if (!props.zoomEnabled) return false; + if (props.maxZoom && newZoomLevel > props.maxZoom) return false; + if (props.minZoom && newZoomLevel < props.minZoom) return false; + + props.onZoomBefore?.(null, null, _getZoomableViewEventObject()); + + // == Perform Pan Animation to preserve the zoom center while zooming == + let listenerId = ''; + if (zoomCenter) { + // Calculates panAnim values based on changes in zoomAnim. + let prevScale = zoomLevel.current; + // Since zoomAnim is calculated in native driver, + // it will jitter panAnim once in a while, + // because here panAnim is being calculated in js. + // However the jittering should mostly occur in simulator. + listenerId = zoomAnim.current.addListener(({ value: newScale }) => { + panAnim.current.setValue({ + x: calcNewScaledOffsetForZoomCentering( + offsetX.current, + originalWidth, + prevScale, + newScale, + zoomCenter.x + ), + y: calcNewScaledOffsetForZoomCentering( + offsetY.current, + originalHeight, + prevScale, + newScale, + zoomCenter.y + ), + }); + prevScale = newScale; }); - prevScale = newScale; - }); - } + } - // == Perform Zoom Animation == - getZoomToAnimation(this.zoomAnim, newZoomLevel).start(() => { - this.zoomAnim.removeListener(listenerId); - }); - // == Zoom Animation Ends == + // == Perform Zoom Animation == + getZoomToAnimation(zoomAnim.current, newZoomLevel).start(() => { + zoomAnim.current.removeListener(listenerId); + }); + // == Zoom Animation Ends == - this.props.onZoomAfter?.(null, null, this._getZoomableViewEventObject()); - return true; - } + props.onZoomAfter?.(null, null, _getZoomableViewEventObject()); + return true; + } + ); /** * Zooms in or out by a specified change level @@ -1050,11 +1008,11 @@ class ReactNativeZoomableView extends Component< * * @return {bool} */ - zoomBy(zoomLevelChange: number) { + const publicZoomBy = useLatestCallback((zoomLevelChange: number) => { // if no zoom level Change given -> just use zoom step - zoomLevelChange ||= this.props.zoomStep || 0; - return this.zoomTo(this.zoomLevel + zoomLevelChange); - } + zoomLevelChange ||= props.zoomStep || 0; + return publicZoomTo(zoomLevel.current + zoomLevelChange); + }); /** * Moves the zoomed view to a specified position @@ -1065,15 +1023,16 @@ class ReactNativeZoomableView extends Component< * * @return {bool} */ - moveTo(newOffsetX: number, newOffsetY: number) { - const { originalWidth, originalHeight } = this.state; - if (!originalWidth || !originalHeight) return; + const publicMoveTo = useLatestCallback( + (newOffsetX: number, newOffsetY: number) => { + if (!originalWidth || !originalHeight) return; - const offsetX = (newOffsetX - originalWidth / 2) / this.zoomLevel; - const offsetY = (newOffsetY - originalHeight / 2) / this.zoomLevel; + const offsetX = (newOffsetX - originalWidth / 2) / zoomLevel.current; + const offsetY = (newOffsetY - originalHeight / 2) / zoomLevel.current; - this._setNewOffsetPosition(-offsetX, -offsetY); - } + _setNewOffsetPosition(-offsetX, -offsetY); + } + ); /** * Moves the zoomed view by a certain amount. @@ -1085,93 +1044,102 @@ class ReactNativeZoomableView extends Component< * * @return {bool} */ - moveBy(offsetChangeX: number, offsetChangeY: number) { - const offsetX = - (this.offsetX * this.zoomLevel - offsetChangeX) / this.zoomLevel; - const offsetY = - (this.offsetY * this.zoomLevel - offsetChangeY) / this.zoomLevel; - - this._setNewOffsetPosition(offsetX, offsetY); - } - - render() { - const { - staticPinIcon, - children, - visualTouchFeedbackEnabled, - doubleTapDelay, - staticPinPosition, - onStaticPinLongPress, - onStaticPinPress, - pinProps, - } = this.props; - - const { pinSize, touches, debugPoints = [] } = this.state; - - return ( - { + const newOffsetX = + (offsetX.current * zoomLevel.current - offsetChangeX) / + zoomLevel.current; + const newOffsetY = + (offsetY.current * zoomLevel.current - offsetChangeY) / + zoomLevel.current; + + _setNewOffsetPosition(newOffsetX, newOffsetY); + } + ); + + useImperativeHandle(ref, () => ({ + zoomTo: publicZoomTo, + zoomBy: publicZoomBy, + moveTo: publicMoveTo, + moveBy: publicMoveBy, + moveStaticPinTo: publicMoveStaticPinTo, + get gestureStarted() { + return gestureStarted.current; + }, + })); + + const { + staticPinIcon, + children, + visualTouchFeedbackEnabled, + doubleTapDelay, + staticPinPosition, + onStaticPinLongPress, + onStaticPinPress, + pinProps, + } = props; + + return ( + + - - {children} - - - {visualTouchFeedbackEnabled && - touches?.map( - (touch) => - doubleTapDelay && ( - { - this._removeTouch(touch); - }} - /> - ) - )} - - {/* For Debugging Only */} - {debugPoints.map(({ x, y }, index) => { - return ; - })} - - {staticPinPosition && ( - { - this.setState({ pinSize: size }); - }} - pinProps={pinProps} - /> + {children} + + + {visualTouchFeedbackEnabled && + stateTouches.map( + (touch) => + doubleTapDelay && ( + { + _removeTouch(touch); + }} + /> + ) )} - - ); - } -} + + {/* For Debugging Only */} + {debugPoints.map(({ x, y }, index) => { + return ; + })} + + {staticPinPosition && ( + + )} + + ); +}; const styles = StyleSheet.create({ container: { diff --git a/lib/module/hooks/useLatestCallback.js b/src/hooks/useLatestCallback.ts similarity index 63% rename from lib/module/hooks/useLatestCallback.js rename to src/hooks/useLatestCallback.ts index 6e0ca7b..2e8f964 100644 --- a/lib/module/hooks/useLatestCallback.js +++ b/src/hooks/useLatestCallback.ts @@ -1,14 +1,14 @@ -"use strict"; - import { useRef } from 'react'; + /** * A hook that returns a stable callback reference that always calls the latest version of the function. * This avoids the need to include the callback in dependency arrays while ensuring the latest version is called. */ - -export const useLatestCallback = callback => { +export const useLatestCallback = ( + callback: (...args: Args) => Return +) => { const ref = useRef(callback); ref.current = callback; - return useRef((...args) => ref.current(...args)).current; + + return useRef((...args) => ref.current(...args)).current; }; -//# sourceMappingURL=useLatestCallback.js.map \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index b01883f..b239cc8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -49,7 +49,7 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.28.5.tgz#a8a4962e1567121ac0b3b487f52107443b455c7f" integrity sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA== -"@babel/core@^7.11.6", "@babel/core@^7.23.9", "@babel/core@^7.25.2": +"@babel/core@^7.11.6", "@babel/core@^7.25.2": version "7.28.5" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.28.5.tgz#4c81b35e51e1b734f510c99b07dfbc7bbbb48f7e" integrity sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw== @@ -130,7 +130,7 @@ jsesc "^2.5.1" source-map "^0.5.0" -"@babel/generator@^7.20.0", "@babel/generator@^7.28.5", "@babel/generator@^7.7.2": +"@babel/generator@^7.20.0", "@babel/generator@^7.28.5": version "7.28.5" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.28.5.tgz#712722d5e50f44d07bc7ac9fe84438742dd61298" integrity sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ== @@ -502,7 +502,7 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.8.tgz#7bacdcbe71bdc3ff936d510c15dcea7cf0b99016" integrity sha512-BRYa3wcQnjS/nqI8Ac94pYYpJfojHVvVXJ97+IDCImX4Jc8W8Xv1+47enbruk+q1etOpsQNwnfFcNGw+gtPGxA== -"@babel/parser@^7.20.0", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.25.3", "@babel/parser@^7.27.2", "@babel/parser@^7.28.5": +"@babel/parser@^7.20.0", "@babel/parser@^7.20.7", "@babel/parser@^7.25.3", "@babel/parser@^7.27.2", "@babel/parser@^7.28.5": version "7.28.5" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.5.tgz#0b0225ee90362f030efd644e8034c99468893b08" integrity sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ== @@ -616,7 +616,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.27.1", "@babel/plugin-syntax-jsx@^7.7.2": +"@babel/plugin-syntax-jsx@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.27.1.tgz#2f9beb5eff30fa507c5532d107daac7b888fa34c" integrity sha512-y8YTNIeKoyhGd9O0Jiyzyyqk8gdjnumGTQPsz0xOZOQ2RmkVJeZ1vmmfIvFEKqucBG6axJGBZDE/7iI5suUI/w== @@ -672,7 +672,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-typescript@^7.27.1", "@babel/plugin-syntax-typescript@^7.7.2": +"@babel/plugin-syntax-typescript@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz#5147d29066a793450f220c63fa3a9431b7e6dd18" integrity sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ== @@ -1378,11 +1378,6 @@ "@babel/helper-validator-identifier" "^7.24.7" to-fast-properties "^2.0.0" -"@bcoe/v8-coverage@^0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" - integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== - "@commitlint/cli@^11.0.0": version "11.0.0" resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-11.0.0.tgz#698199bc52afed50aa28169237758fa14a67b5d3" @@ -1596,57 +1591,11 @@ js-yaml "^3.13.1" resolve-from "^5.0.0" -"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": +"@istanbuljs/schema@^0.1.2": version "0.1.3" resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" - integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== - dependencies: - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - slash "^3.0.0" - -"@jest/core@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" - integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== - dependencies: - "@jest/console" "^29.7.0" - "@jest/reporters" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - ci-info "^3.2.0" - exit "^0.1.2" - graceful-fs "^4.2.9" - jest-changed-files "^29.7.0" - jest-config "^29.7.0" - jest-haste-map "^29.7.0" - jest-message-util "^29.7.0" - jest-regex-util "^29.6.3" - jest-resolve "^29.7.0" - jest-resolve-dependencies "^29.7.0" - jest-runner "^29.7.0" - jest-runtime "^29.7.0" - jest-snapshot "^29.7.0" - jest-util "^29.7.0" - jest-validate "^29.7.0" - jest-watcher "^29.7.0" - micromatch "^4.0.4" - pretty-format "^29.7.0" - slash "^3.0.0" - strip-ansi "^6.0.0" - "@jest/create-cache-key-function@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz#793be38148fab78e65f40ae30c36785f4ad859f0" @@ -1664,21 +1613,6 @@ "@types/node" "*" jest-mock "^29.7.0" -"@jest/expect-utils@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" - integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== - dependencies: - jest-get-type "^29.6.3" - -"@jest/expect@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" - integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== - dependencies: - expect "^29.7.0" - jest-snapshot "^29.7.0" - "@jest/fake-timers@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" @@ -1691,46 +1625,6 @@ jest-mock "^29.7.0" jest-util "^29.7.0" -"@jest/globals@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" - integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/expect" "^29.7.0" - "@jest/types" "^29.6.3" - jest-mock "^29.7.0" - -"@jest/reporters@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" - integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== - dependencies: - "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@jridgewell/trace-mapping" "^0.3.18" - "@types/node" "*" - chalk "^4.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.3" - graceful-fs "^4.2.9" - istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^6.0.0" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.1.3" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - jest-worker "^29.7.0" - slash "^3.0.0" - string-length "^4.0.1" - strip-ansi "^6.0.0" - v8-to-istanbul "^9.0.1" - "@jest/schemas@^29.6.3": version "29.6.3" resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" @@ -1738,35 +1632,6 @@ dependencies: "@sinclair/typebox" "^0.27.8" -"@jest/source-map@^29.6.3": - version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" - integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== - dependencies: - "@jridgewell/trace-mapping" "^0.3.18" - callsites "^3.0.0" - graceful-fs "^4.2.9" - -"@jest/test-result@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" - integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== - dependencies: - "@jest/console" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/istanbul-lib-coverage" "^2.0.0" - collect-v8-coverage "^1.0.0" - -"@jest/test-sequencer@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" - integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== - dependencies: - "@jest/test-result" "^29.7.0" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - slash "^3.0.0" - "@jest/transform@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" @@ -1858,7 +1723,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba" integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og== -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.28": +"@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.28": version "0.3.31" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz#db15d6781c931f3a251a3dac39501c98a6082fd0" integrity sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw== @@ -2217,11 +2082,6 @@ resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762" integrity sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw== -"@types/istanbul-lib-coverage@^2.0.1": - version "2.0.6" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" - integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== - "@types/istanbul-lib-report@*": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" @@ -2236,14 +2096,6 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@29": - version "29.5.14" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5" - integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ== - dependencies: - expect "^29.0.0" - pretty-format "^29.0.0" - "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" @@ -3123,11 +2975,6 @@ chalk@^2.0.0, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -char-regex@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" - integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== - chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" @@ -3170,11 +3017,6 @@ ci-info@^3.2.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.3.1.tgz#58331f6f472a25fe3a50a351ae3052936c2c7f32" integrity sha512-SXgeMX9VwDe7iFFaEWkA5AstuER9YKqy4EhHqr4DVqkwmD9rpVimkMKWHdjn30Ja45txyjhSn63lVX69eVCckg== -cjs-module-lexer@^1.0.0: - version "1.4.3" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz#0f79731eb8cfe1ec72acd4066efac9d61991b00d" - integrity sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q== - clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" @@ -3241,16 +3083,6 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== - -collect-v8-coverage@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.3.tgz#cc1f01eb8d02298cbc9a437c74c70ab4e5210b80" - integrity sha512-1L5aqIkwPfiodaMgQunkF1zRhNqifHBmtbbbxcr6yVxxBnliw4TDOW6NxpO8DJLgJ16OT+Y4ztZqP6p/FtXnAw== - color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -3567,19 +3399,6 @@ cosmiconfig@^9.0.0: js-yaml "^4.1.0" parse-json "^5.2.0" -create-jest@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" - integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== - dependencies: - "@jest/types" "^29.6.3" - chalk "^4.0.0" - exit "^0.1.2" - graceful-fs "^4.2.9" - jest-config "^29.7.0" - jest-util "^29.7.0" - prompts "^2.0.1" - cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -3650,13 +3469,6 @@ debug@4, debug@4.3.2, debug@^4.1.0: dependencies: ms "2.1.2" -debug@^4.1.1, debug@^4.4.0, debug@^4.4.1: - version "4.4.3" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" - integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== - dependencies: - ms "^2.1.3" - debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.7" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" @@ -3664,6 +3476,13 @@ debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: dependencies: ms "^2.1.3" +debug@^4.4.0, debug@^4.4.1: + version "4.4.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" + integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== + dependencies: + ms "^2.1.3" + decamelize-keys@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" @@ -3701,11 +3520,6 @@ dedent@^0.7.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= -dedent@^1.0.0: - version "1.7.1" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.7.1.tgz#364661eea3d73f3faba7089214420ec2f8f13e15" - integrity sha512-9JmrhGZpOlEgOLdQgSm0zxFaYoQon408V1v49aqTWuXENVlnCuY9JBZcXZiCsZQWDjTm5Qf/nIvAy77mXDAjEg== - deep-extend@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" @@ -3716,11 +3530,6 @@ deep-is@^0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -deepmerge@^4.2.2: - version "4.3.1" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" - integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== - defaults@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" @@ -3810,16 +3619,6 @@ destroy@1.2.0: resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== -detect-newline@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" - integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== - -diff-sequences@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" - integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== - dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -3873,11 +3672,6 @@ electron-to-chromium@^1.5.4: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.24.tgz#b3cd2f71b7a84bac340d862e3b7b0aadf48478de" integrity sha512-0x0wLCmpdKFCi9ulhvYZebgcPmHTkFVUfU2wzDykadkslKwT4oAmDTHEKLnlrDsMGZe4B+ksn8quZfZjYsBetA== -emittery@^0.13.1: - version "0.13.1" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" - integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== - emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -4317,7 +4111,7 @@ event-target-shim@^5.0.0, event-target-shim@^5.0.1: resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== -execa@5.1.1, execa@^5.0.0: +execa@5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== @@ -4347,22 +4141,6 @@ execa@^4.0.2, execa@^4.0.3: signal-exit "^3.0.2" strip-final-newline "^2.0.0" -exit@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== - -expect@^29.0.0, expect@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" - integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== - dependencies: - "@jest/expect-utils" "^29.7.0" - jest-get-type "^29.6.3" - jest-matcher-utils "^29.7.0" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - exponential-backoff@^3.1.1: version "3.1.3" resolved "https://registry.yarnpkg.com/exponential-backoff/-/exponential-backoff-3.1.3.tgz#51cf92c1c0493c766053f9d3abee4434c244d2f6" @@ -4493,7 +4271,7 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" -find-up@^4.0.0, find-up@^4.1.0: +find-up@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== @@ -5050,11 +4828,6 @@ hosted-git-info@^4.0.0, hosted-git-info@^4.0.1: dependencies: lru-cache "^6.0.0" -html-escaper@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" - integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== - http-cache-semantics@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" @@ -5185,14 +4958,6 @@ import-lazy@^2.1.0: resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" integrity sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM= -import-local@^3.0.2: - version "3.2.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" - integrity sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA== - dependencies: - pkg-dir "^4.2.0" - resolve-cwd "^3.0.0" - imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" @@ -5405,11 +5170,6 @@ is-fullwidth-code-point@^3.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -is-generator-fn@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" - integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== - is-generator-function@^1.0.10: version "1.0.10" resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.10.tgz#f1558baf1ac17e0deea7c0415c438351ff2b3c72" @@ -5663,11 +5423,6 @@ istanbul-lib-coverage@^3.0.0: resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.2.tgz#36786d4d82aad2ea5911007e255e2da6b5f80d86" integrity sha512-o5+eTUYzCJ11/+JhW5/FUCdfsdoYVdQ/8I/OveE2XsjehYn5DdeSnNQAbjYaO8gQ6hvGTN6GM6ddQqpTVG5j8g== -istanbul-lib-coverage@^3.2.0: - version "3.2.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" - integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== - istanbul-lib-instrument@^5.0.4: version "5.0.4" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.0.4.tgz#e976f2aa66ebc6737f236d3ab05b76e36f885c80" @@ -5679,43 +5434,6 @@ istanbul-lib-instrument@^5.0.4: istanbul-lib-coverage "^3.0.0" semver "^6.3.0" -istanbul-lib-instrument@^6.0.0: - version "6.0.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" - integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== - dependencies: - "@babel/core" "^7.23.9" - "@babel/parser" "^7.23.9" - "@istanbuljs/schema" "^0.1.3" - istanbul-lib-coverage "^3.2.0" - semver "^7.5.4" - -istanbul-lib-report@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" - integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== - dependencies: - istanbul-lib-coverage "^3.0.0" - make-dir "^4.0.0" - supports-color "^7.1.0" - -istanbul-lib-source-maps@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" - integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== - dependencies: - debug "^4.1.1" - istanbul-lib-coverage "^3.0.0" - source-map "^0.6.1" - -istanbul-reports@^3.1.3: - version "3.2.0" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.2.0.tgz#cb4535162b5784aa623cee21a7252cf2c807ac93" - integrity sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA== - dependencies: - html-escaper "^2.0.0" - istanbul-lib-report "^3.0.0" - iterator.prototype@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/iterator.prototype/-/iterator.prototype-1.1.2.tgz#5e29c8924f01916cb9335f1ff80619dcff22b0c0" @@ -5727,114 +5445,6 @@ iterator.prototype@^1.1.2: reflect.getprototypeof "^1.0.4" set-function-name "^2.0.1" -jest-changed-files@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" - integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== - dependencies: - execa "^5.0.0" - jest-util "^29.7.0" - p-limit "^3.1.0" - -jest-circus@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.7.0.tgz#b6817a45fcc835d8b16d5962d0c026473ee3668a" - integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/expect" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - co "^4.6.0" - dedent "^1.0.0" - is-generator-fn "^2.0.0" - jest-each "^29.7.0" - jest-matcher-utils "^29.7.0" - jest-message-util "^29.7.0" - jest-runtime "^29.7.0" - jest-snapshot "^29.7.0" - jest-util "^29.7.0" - p-limit "^3.1.0" - pretty-format "^29.7.0" - pure-rand "^6.0.0" - slash "^3.0.0" - stack-utils "^2.0.3" - -jest-cli@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" - integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== - dependencies: - "@jest/core" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/types" "^29.6.3" - chalk "^4.0.0" - create-jest "^29.7.0" - exit "^0.1.2" - import-local "^3.0.2" - jest-config "^29.7.0" - jest-util "^29.7.0" - jest-validate "^29.7.0" - yargs "^17.3.1" - -jest-config@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" - integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== - dependencies: - "@babel/core" "^7.11.6" - "@jest/test-sequencer" "^29.7.0" - "@jest/types" "^29.6.3" - babel-jest "^29.7.0" - chalk "^4.0.0" - ci-info "^3.2.0" - deepmerge "^4.2.2" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-circus "^29.7.0" - jest-environment-node "^29.7.0" - jest-get-type "^29.6.3" - jest-regex-util "^29.6.3" - jest-resolve "^29.7.0" - jest-runner "^29.7.0" - jest-util "^29.7.0" - jest-validate "^29.7.0" - micromatch "^4.0.4" - parse-json "^5.2.0" - pretty-format "^29.7.0" - slash "^3.0.0" - strip-json-comments "^3.1.1" - -jest-diff@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" - integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== - dependencies: - chalk "^4.0.0" - diff-sequences "^29.6.3" - jest-get-type "^29.6.3" - pretty-format "^29.7.0" - -jest-docblock@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" - integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== - dependencies: - detect-newline "^3.0.0" - -jest-each@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" - integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== - dependencies: - "@jest/types" "^29.6.3" - chalk "^4.0.0" - jest-get-type "^29.6.3" - jest-util "^29.7.0" - pretty-format "^29.7.0" - jest-environment-node@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" @@ -5871,24 +5481,6 @@ jest-haste-map@^29.7.0: optionalDependencies: fsevents "^2.3.2" -jest-leak-detector@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" - integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== - dependencies: - jest-get-type "^29.6.3" - pretty-format "^29.7.0" - -jest-matcher-utils@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" - integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== - dependencies: - chalk "^4.0.0" - jest-diff "^29.7.0" - jest-get-type "^29.6.3" - pretty-format "^29.7.0" - jest-message-util@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" @@ -5913,120 +5505,11 @@ jest-mock@^29.7.0: "@types/node" "*" jest-util "^29.7.0" -jest-pnp-resolver@^1.2.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" - integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== - jest-regex-util@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== -jest-resolve-dependencies@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" - integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== - dependencies: - jest-regex-util "^29.6.3" - jest-snapshot "^29.7.0" - -jest-resolve@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" - integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== - dependencies: - chalk "^4.0.0" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - jest-pnp-resolver "^1.2.2" - jest-util "^29.7.0" - jest-validate "^29.7.0" - resolve "^1.20.0" - resolve.exports "^2.0.0" - slash "^3.0.0" - -jest-runner@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" - integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== - dependencies: - "@jest/console" "^29.7.0" - "@jest/environment" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - emittery "^0.13.1" - graceful-fs "^4.2.9" - jest-docblock "^29.7.0" - jest-environment-node "^29.7.0" - jest-haste-map "^29.7.0" - jest-leak-detector "^29.7.0" - jest-message-util "^29.7.0" - jest-resolve "^29.7.0" - jest-runtime "^29.7.0" - jest-util "^29.7.0" - jest-watcher "^29.7.0" - jest-worker "^29.7.0" - p-limit "^3.1.0" - source-map-support "0.5.13" - -jest-runtime@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" - integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/fake-timers" "^29.7.0" - "@jest/globals" "^29.7.0" - "@jest/source-map" "^29.6.3" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - cjs-module-lexer "^1.0.0" - collect-v8-coverage "^1.0.0" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - jest-message-util "^29.7.0" - jest-mock "^29.7.0" - jest-regex-util "^29.6.3" - jest-resolve "^29.7.0" - jest-snapshot "^29.7.0" - jest-util "^29.7.0" - slash "^3.0.0" - strip-bom "^4.0.0" - -jest-snapshot@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" - integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== - dependencies: - "@babel/core" "^7.11.6" - "@babel/generator" "^7.7.2" - "@babel/plugin-syntax-jsx" "^7.7.2" - "@babel/plugin-syntax-typescript" "^7.7.2" - "@babel/types" "^7.3.3" - "@jest/expect-utils" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - babel-preset-current-node-syntax "^1.0.0" - chalk "^4.0.0" - expect "^29.7.0" - graceful-fs "^4.2.9" - jest-diff "^29.7.0" - jest-get-type "^29.6.3" - jest-matcher-utils "^29.7.0" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - natural-compare "^1.4.0" - pretty-format "^29.7.0" - semver "^7.5.3" - jest-util@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" @@ -6051,20 +5534,6 @@ jest-validate@^29.6.3, jest-validate@^29.7.0: leven "^3.1.0" pretty-format "^29.7.0" -jest-watcher@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" - integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== - dependencies: - "@jest/test-result" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - emittery "^0.13.1" - jest-util "^29.7.0" - string-length "^4.0.1" - jest-worker@^29.6.3, jest-worker@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" @@ -6075,16 +5544,6 @@ jest-worker@^29.6.3, jest-worker@^29.7.0: merge-stream "^2.0.0" supports-color "^8.0.0" -jest@29: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" - integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== - dependencies: - "@jest/core" "^29.7.0" - "@jest/types" "^29.6.3" - import-local "^3.0.2" - jest-cli "^29.7.0" - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -6372,13 +5831,6 @@ make-dir@^3.0.0: dependencies: semver "^6.0.0" -make-dir@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" - integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== - dependencies: - semver "^7.5.3" - makeerror@1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" @@ -7270,7 +6722,7 @@ p-limit@^2.0.0, p-limit@^2.2.0: dependencies: p-try "^2.0.0" -p-limit@^3.0.2, p-limit@^3.1.0: +p-limit@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== @@ -7462,13 +6914,6 @@ pirates@^4.0.4: resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.7.tgz#643b4a18c4257c8a65104b73f3049ce9a0a15e22" integrity sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA== -pkg-dir@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" - integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== - dependencies: - find-up "^4.0.0" - pkg-dir@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-5.0.0.tgz#a02d6aebe6ba133a928f74aec20bafdfe6b8e760" @@ -7530,7 +6975,7 @@ prettier@^2.0.5: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c" integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA== -pretty-format@^29.0.0, pretty-format@^29.7.0: +pretty-format@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== @@ -7551,7 +6996,7 @@ promise@^8.3.0: dependencies: asap "~2.0.6" -prompts@^2.0.1, prompts@^2.4.2: +prompts@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== @@ -7602,11 +7047,6 @@ pupa@^2.1.1: dependencies: escape-goat "^2.0.0" -pure-rand@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" - integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== - q@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" @@ -7973,13 +7413,6 @@ resolve-alpn@^1.0.0: resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g== -resolve-cwd@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" - integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== - dependencies: - resolve-from "^5.0.0" - resolve-from@5.0.0, resolve-from@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" @@ -8002,11 +7435,6 @@ resolve-global@1.0.0, resolve-global@^1.0.0: dependencies: global-dirs "^0.1.1" -resolve.exports@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.3.tgz#41955e6f1b4013b7586f873749a635dea07ebe3f" - integrity sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A== - resolve@^1.1.6, resolve@^1.10.0: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" @@ -8015,7 +7443,7 @@ resolve@^1.1.6, resolve@^1.10.0: is-core-module "^2.2.0" path-parse "^1.0.6" -resolve@^1.20.0, resolve@^1.22.10, resolve@^1.22.8: +resolve@^1.22.10, resolve@^1.22.8: version "1.22.11" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.11.tgz#aad857ce1ffb8bfa9b0b1ac29f1156383f68c262" integrity sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ== @@ -8174,7 +7602,7 @@ semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.1.3, semver@^7.5.3, semver@^7.5.4: +semver@^7.1.3: version "7.7.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.3.tgz#4b5f4143d007633a8dc671cd0a6ef9147b8bb946" integrity sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q== @@ -8315,14 +7743,6 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -source-map-support@0.5.13: - version "0.5.13" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" - integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - source-map-support@~0.5.20: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" @@ -8425,14 +7845,6 @@ strict-uri-encode@^2.0.0: resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" integrity sha1-ucczDHBChi9rFC3CdLvMWGbONUY= -string-length@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" - integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== - dependencies: - char-regex "^1.0.2" - strip-ansi "^6.0.0" - string-natural-compare@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" @@ -8543,11 +7955,6 @@ strip-bom@^3.0.0: resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= -strip-bom@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" - integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== - strip-final-newline@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" @@ -8990,15 +8397,6 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -v8-to-istanbul@^9.0.1: - version "9.3.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz#b9572abfa62bd556c16d75fdebc1a411d5ff3175" - integrity sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA== - dependencies: - "@jridgewell/trace-mapping" "^0.3.12" - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^2.0.0" - validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -9283,7 +8681,7 @@ yargs@^16.2.0: y18n "^5.0.5" yargs-parser "^20.2.2" -yargs@^17.3.1, yargs@^17.5.1, yargs@^17.6.2: +yargs@^17.5.1, yargs@^17.6.2: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==