react-zoom-pan-pinch 3.0.3 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-zoom-pan-pinch",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
4
4
  "description": "Zoom and pan html elements in easy way",
5
5
  "author": "prc5",
6
6
  "license": "MIT",
@@ -11,7 +11,7 @@
11
11
  "scripts": {
12
12
  "build": "rollup -c",
13
13
  "build:docs": "build-storybook",
14
- "start": "start-storybook -p 6006 --no-manager-cache",
14
+ "start": "DISABLE_ESLINT_PLUGIN=true start-storybook -p 6006 --no-manager-cache",
15
15
  "test": "jest",
16
16
  "lint": "eslint . --ext .js,.jsx,.tsx,.ts --fix",
17
17
  "format": "prettier --write .",
@@ -94,6 +94,10 @@
94
94
  "webpack": "5",
95
95
  "webpack-cli": "^5.0.1"
96
96
  },
97
+ "files": [
98
+ "dist",
99
+ "src"
100
+ ],
97
101
  "engines": {
98
102
  "node": ">=8",
99
103
  "npm": ">=5"
package/.eslintignore DELETED
@@ -1,6 +0,0 @@
1
- dist
2
- node_modules
3
- storybook-static
4
- .storybook
5
- coverage
6
- rollup.config.js
@@ -1,36 +0,0 @@
1
- # This is a comment.
2
- # Each line is a file pattern followed by one or more owners.
3
-
4
- # These owners will be the default owners for everything in
5
- # the repo. Unless a later match takes precedence, they will
6
- # be requested for review when someone opens a pull request.
7
- * @prc5
8
-
9
- # Order is important; the last matching pattern takes the most
10
- # precedence. When someone opens a pull request that only
11
- # modifies JS files, only @js-owner and not the global
12
- # owner(s) will be requested for a review.
13
- # *.js @js-owner
14
-
15
- # You can also use email addresses if you prefer. They'll be
16
- # used to look up users just like we do for commit author
17
- # emails.
18
- # *.go docs@example.com
19
-
20
- # In this example, @doctocat owns any files in the build/logs
21
- # directory at the root of the repository and any of its
22
- # subdirectories.
23
- # /build/logs/ @doctocat
24
-
25
- # The `docs/*` pattern will match files like
26
- # `docs/getting-started.md` but not further nested files like
27
- # `docs/build-app/troubleshooting.md`.
28
- # docs/* docs@example.com
29
-
30
- # In this example, @octocat owns any file in an apps directory
31
- # anywhere in your repository.
32
- # apps/ @octocat
33
-
34
- # In this example, @doctocat owns any file in the `/docs`
35
- # directory in the root of your repository.
36
- # /docs/ @doctocat
@@ -1,13 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: [prc5] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
- patreon: # Replace with a single Patreon username
5
- open_collective: # Replace with a single Open Collective username
6
- ko_fi: # Replace with a single Ko-fi username
7
- tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
- community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
- liberapay: # Replace with a single Liberapay username
10
- issuehunt: # Replace with a single IssueHunt username
11
- otechie: # Replace with a single Otechie username
12
- lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13
- custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -1,38 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Describe the bug**
11
- A clear and concise description of what the bug is.
12
-
13
- **To Reproduce**
14
- Steps to reproduce the behavior:
15
- 1. Go to '...'
16
- 2. Click on '....'
17
- 3. Scroll down to '....'
18
- 4. See error
19
-
20
- **Expected behavior**
21
- A clear and concise description of what you expected to happen.
22
-
23
- **Screenshots**
24
- If applicable, add screenshots to help explain your problem.
25
-
26
- **Desktop (please complete the following information):**
27
- - OS: [e.g. iOS]
28
- - Browser [e.g. chrome, safari]
29
- - Version [e.g. 22]
30
-
31
- **Smartphone (please complete the following information):**
32
- - Device: [e.g. iPhone6]
33
- - OS: [e.g. iOS8.1]
34
- - Browser [e.g. stock browser, safari]
35
- - Version [e.g. 22]
36
-
37
- **Additional context**
38
- Add any other context about the problem here.
@@ -1,20 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this project
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Is your feature request related to a problem? Please describe.**
11
- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
-
13
- **Describe the solution you'd like**
14
- A clear and concise description of what you want to happen.
15
-
16
- **Describe alternatives you've considered**
17
- A clear and concise description of any alternative solutions or features you've considered.
18
-
19
- **Additional context**
20
- Add any other context or screenshots about the feature request here.
@@ -1,34 +0,0 @@
1
- name: Deploy docs
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
-
8
- jobs:
9
- build:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - name: Checkout
13
- uses: actions/checkout@v3
14
-
15
- - name: Set up Node
16
- uses: actions/setup-node@v3
17
- with:
18
- node-version: "16"
19
- cache: "yarn"
20
-
21
- - name: Install packages
22
- run: yarn install
23
-
24
- - name: Build docs
25
- run: yarn build:docs
26
- env:
27
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28
-
29
- - name: Deploy
30
- run: |
31
- git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
32
- npx gh-pages -d storybook-static -u "github-actions-bot <support+actions@github.com>"
33
- env:
34
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,46 +0,0 @@
1
- name: Release packages
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
- - beta
8
- - alpha
9
-
10
- defaults:
11
- run:
12
- shell: sh
13
-
14
- jobs:
15
- release:
16
- name: Release
17
- runs-on: ubuntu-latest
18
- steps:
19
- - name: Wait on tests
20
- uses: lewagon/wait-on-check-action@v1.1.2
21
- with:
22
- ref: ${{ github.ref }}
23
- check-name: "Run tests"
24
- repo-token: ${{ secrets.GITHUB_TOKEN }}
25
- wait-interval: 10
26
-
27
- - name: Checkout
28
- uses: actions/checkout@v3
29
-
30
- - name: Set up Node
31
- uses: actions/setup-node@v3
32
- with:
33
- node-version: "16"
34
- cache: "yarn"
35
-
36
- - name: Install packages
37
- run: yarn install
38
-
39
- - name: Build
40
- run: yarn build
41
-
42
- - name: Publish
43
- run: yarn release
44
- env:
45
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,42 +0,0 @@
1
- name: Tests
2
-
3
- on: push
4
-
5
- jobs:
6
- tests:
7
- name: Run tests
8
- runs-on: ubuntu-latest
9
- steps:
10
- - name: Checkout
11
- uses: actions/checkout@v3
12
-
13
- - name: Set up Node.js
14
- uses: actions/setup-node@v3
15
- with:
16
- node-version: "16"
17
- cache: "yarn"
18
-
19
- - name: Install packages
20
- run: yarn install
21
-
22
- - name: Build
23
- run: yarn build
24
-
25
- - name: Lint
26
- run: yarn lint
27
-
28
- - name: Typecheck
29
- run: yarn typecheck
30
-
31
- - name: Clear Jest
32
- run: yarn jest --clearCache
33
-
34
- - name: Test
35
- run: yarn test --coverage
36
-
37
- # - name: Send Report
38
- # uses: paambaati/codeclimate-action@v3.0.0
39
- # env:
40
- # CC_TEST_REPORTER_ID: 7d1e3713df373ab2c9efce24b85c16efa2bd953aae32bd9d278004784d71291e
41
- # with:
42
- # coverageLocations: ${{github.workspace}}/coverage/lcov.info:lcov
package/.prettierrc DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "tabWidth": 2,
3
- "useTabs": false,
4
- "semi": true,
5
- "singleQuote": false,
6
- "trailingComma": "all",
7
- "bracketSpacing": true,
8
- "jsxBracketSameLine": false,
9
- "proseWrap": "always"
10
- }
package/.releaserc.json DELETED
@@ -1,63 +0,0 @@
1
- {
2
- "branches": [
3
- "+([0-9])?(.{+([0-9]),x}).x",
4
- {
5
- "name": "master"
6
- },
7
- {
8
- "name": "beta",
9
- "prerelease": true
10
- },
11
- {
12
- "name": "alpha",
13
- "prerelease": true
14
- }
15
- ],
16
- "release": {
17
- "plugins": [
18
- [
19
- "@semantic-release/commit-analyzer",
20
- {
21
- "releaseRules": [
22
- {
23
- "scope": "no-release",
24
- "release": false
25
- },
26
- {
27
- "breaking": true,
28
- "release": "major"
29
- },
30
- {
31
- "type": "feat",
32
- "release": "minor"
33
- },
34
- {
35
- "type": "refactor",
36
- "scope": "core-*",
37
- "release": "minor"
38
- },
39
- {
40
- "type": "*",
41
- "release": "patch"
42
- }
43
- ]
44
- }
45
- ],
46
- [
47
- "@semantic-release/changelog",
48
- {
49
- "changelogFile": "CHANGELOG.md"
50
- }
51
- ],
52
- "@semantic-release/release-notes-generator",
53
- "@semantic-release/npm",
54
- [
55
- "@semantic-release/git",
56
- {
57
- "assets": ["CHANGELOG.md"]
58
- }
59
- ],
60
- "@semantic-release/github"
61
- ]
62
- }
63
- }
@@ -1,23 +0,0 @@
1
- module.exports = {
2
- stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|ts|tsx)"],
3
- addons: [
4
- "@storybook/addon-links",
5
- "@storybook/addon-essentials",
6
- "@storybook/preset-create-react-app",
7
- "@storybook/addon-storysource",
8
- "@storybook/addon-a11y",
9
- ],
10
- core: {
11
- builder: "webpack5",
12
- },
13
- framework: "@storybook/react",
14
- webpackFinal: (webpackConfig) => {
15
- const scopePluginIndex = webpackConfig.resolve.plugins.findIndex(
16
- ({ constructor }) =>
17
- constructor && constructor.name === "ModuleScopePlugin",
18
- );
19
-
20
- webpackConfig.resolve.plugins.splice(scopePluginIndex, 1);
21
- return webpackConfig;
22
- },
23
- };
@@ -1,5 +0,0 @@
1
- <link rel="preconnect" href="https://fonts.gstatic.com" />
2
- <link
3
- href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100&display=swap"
4
- rel="stylesheet"
5
- />
@@ -1,11 +0,0 @@
1
- import "./theme-overrides.css";
2
-
3
- export const parameters = {
4
- actions: { argTypesRegex: "^on[A-Z].*" },
5
- controls: {
6
- matchers: {
7
- color: /(background|color)$/i,
8
- date: /Date$/,
9
- },
10
- },
11
- };
@@ -1,49 +0,0 @@
1
- body {
2
- font-family: "Poppins", sans-serif;
3
- font-style: normal;
4
- font-weight: normal;
5
- font-size: 13px;
6
- line-height: 130%;
7
- font-style: normal;
8
- -webkit-font-smoothing: antialiased;
9
- -moz-osx-font-smoothing: grayscale;
10
- }
11
-
12
- body .sbdocs {
13
- max-width: unset;
14
- }
15
-
16
- .react-transform-wrapper {
17
- background-color: rgba(0, 0, 0, 0.3);
18
- }
19
-
20
- body td > pre.prism-code {
21
- background: transparent !important;
22
- overflow: auto;
23
- }
24
-
25
- .props-table {
26
- width: 100%;
27
- }
28
-
29
- .props-table th {
30
- text-align: left;
31
- }
32
-
33
- .is-object-row td {
34
- background: #d8e2f5;
35
- border-top: 2px solid rgb(173 173 173) !important;
36
- }
37
-
38
- .react-transform-wrapper {
39
- max-width: 80vw;
40
- max-height: 80vh;
41
- }
42
-
43
- .handlers-table {
44
- width: 100%;
45
- }
46
-
47
- .handlers-table th {
48
- text-align: left;
49
- }
package/CHANGELOG.md DELETED
@@ -1,26 +0,0 @@
1
- # CHANGELOG
2
-
3
- ## Version: 3.0.0
4
-
5
- - Removed render props performance issues. I've removed state from render props,
6
- now if we want to listen to it's changes we need to use useTransformEffect
7
- hook
8
- - Created helper hooks for handling controls, transform state and context
9
- without performance issues with rerendering
10
- - Added KeepScale, MiniMap components
11
- - Added documentation about new hooks
12
- - New readme
13
- - Semantic release
14
-
15
- ## Version: 2.1.3
16
-
17
- ##### Published: 24.07.2021
18
-
19
- 1. Alignment animation size changes:
20
-
21
- - "padding" size is not longer calculated based on the wrapper size - it's now
22
- represented by pixels
23
- - you can set separate "padding" values for X and Y
24
-
25
- 2. Storybook docs fix - prevented to log every action callback since it was
26
- killing performance
@@ -1,61 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make
6
- participation in our project and our community a harassment-free experience for everyone, regardless of age, body size,
7
- disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education,
8
- socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
9
-
10
- ## Our Standards
11
-
12
- Examples of behavior that contributes to creating a positive environment include:
13
-
14
- - Using welcoming and inclusive language
15
- - Being respectful of differing viewpoints and experiences
16
- - Gracefully accepting constructive criticism
17
- - Focusing on what is best for the community
18
- - Showing empathy towards other community members
19
-
20
- Examples of unacceptable behavior by participants include:
21
-
22
- - The use of sexualized language or imagery and unwelcome sexual attention or advances
23
- - Trolling, insulting/derogatory comments, and personal or political attacks
24
- - Public or private harassment
25
- - Publishing others' private information, such as a physical or electronic address, without explicit permission
26
- - Other conduct which could reasonably be considered inappropriate in a professional setting
27
-
28
- ## Our Responsibilities
29
-
30
- Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take
31
- appropriate and fair corrective action in response to any instances of unacceptable behavior.
32
-
33
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
34
- issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any
35
- contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
36
-
37
- ## Scope
38
-
39
- This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the
40
- project or its community in public spaces. Examples of representing a project or community include using an official
41
- project e-mail address, posting via an official social media account, or acting as an appointed representative at an
42
- online or offline event. Representation of a project may be further defined and clarified by project maintainers.
43
-
44
- ## Enforcement
45
-
46
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at
47
- maciekpyrc@gmail.com. All complaints will be reviewed and investigated and will result in a response that is deemed
48
- necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to
49
- the reporter of an incident. Further details of specific enforcement policies may be posted separately.
50
-
51
- Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent
52
- repercussions as determined by other members of the project's leadership.
53
-
54
- ## Attribution
55
-
56
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at
57
- https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
58
-
59
- [homepage]: https://www.contributor-covenant.org
60
-
61
- For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
package/Contributing.md DELETED
@@ -1,236 +0,0 @@
1
- <!-- omit in toc -->
2
-
3
- # Contributing to Zoom Pan Pinch
4
-
5
- First off, thanks for taking the time to contribute! ❤️
6
-
7
- All types of contributions are encouraged and valued. See the
8
- [Table of Contents](#table-of-contents) for different ways to help and details
9
- about how this project handles them. Please make sure to read the relevant
10
- section before making your contribution. It will make it a lot easier for us
11
- maintainers and smooth out the experience for all involved. The community looks
12
- forward to your contributions. 🎉
13
-
14
- > And if you like the project, but just don't have time to contribute, that's
15
- > fine. There are other easy ways to support the project and show your
16
- > appreciation, which we would also be very happy about:
17
- >
18
- > - Star the project
19
- > - Tweet about it
20
- > - Refer this project in your project's readme
21
- > - Mention the project at local meetups and tell your friends/colleagues
22
-
23
- <!-- omit in toc -->
24
-
25
- ## Table of Contents
26
-
27
- - [Contributing to Zoom Pan Pinch](#contributing-to-zoom-pan-pinch)
28
- - [Table of Contents](#table-of-contents)
29
- - [I Have a Question](#i-have-a-question)
30
- - [I Want To Contribute](#i-want-to-contribute)
31
- - [Reporting Bugs](#reporting-bugs)
32
- - [Before Submitting a Bug Report](#before-submitting-a-bug-report)
33
- - [How Do I Submit a Good Bug Report?](#how-do-i-submit-a-good-bug-report)
34
- - [Suggesting Enhancements](#suggesting-enhancements)
35
- - [Before Submitting an Enhancement](#before-submitting-an-enhancement)
36
- - [How Do I Submit a Good Enhancement Suggestion?](#how-do-i-submit-a-good-enhancement-suggestion)
37
- - [Your First Code Contribution](#your-first-code-contribution)
38
- - [Improving The Documentation](#improving-the-documentation)
39
- - [Styleguides](#styleguides)
40
- - [Commit Messages](#commit-messages)
41
- - [Join The Project Team](#join-the-project-team)
42
- - [Attribution](#attribution)
43
-
44
- ## I Have a Question
45
-
46
- > If you want to ask a question, we assume that you have read the available
47
- > [Documentation](https://prc5.github.io/react-zoom-pan-pinch/).
48
-
49
- Before you ask a question, it is best to search for existing
50
- [Issues](https://github.com/prc5/react-zoom-pan-pinch/issues) that might help
51
- you. In case you have found a suitable issue and still need clarification, you
52
- can write your question in this issue. It is also advisable to search the
53
- internet for answers first.
54
-
55
- If you then still feel the need to ask a question and need clarification, we
56
- recommend the following:
57
-
58
- - Open an [Issue](https://github.com/prc5/react-zoom-pan-pinch/issues/new).
59
- - Provide as much context as you can about what you're running into.
60
- - Provide project and platform versions (nodejs, npm, etc), depending on what
61
- seems relevant.
62
-
63
- We will then take care of the issue as soon as possible.
64
-
65
- <!--
66
- You might want to create a separate issue tag for questions and include it in this description. People should then tag their issues accordingly.
67
-
68
- Depending on how large the project is, you may want to outsource the questioning, e.g. to Stack Overflow or Gitter. You may add additional contact and information possibilities:
69
- - IRC
70
- - Slack
71
- - Gitter
72
- - Stack Overflow tag
73
- - Blog
74
- - FAQ
75
- - Roadmap
76
- - E-Mail List
77
- - Forum
78
- -->
79
-
80
- ## I Want To Contribute
81
-
82
- > ### Legal Notice <!-- omit in toc -->
83
- >
84
- > When contributing to this project, you must agree that you have authored 100%
85
- > of the content, that you have the necessary rights to the content and that the
86
- > content you contribute may be provided under the project license.
87
-
88
- ### Reporting Bugs
89
-
90
- <!-- omit in toc -->
91
-
92
- #### Before Submitting a Bug Report
93
-
94
- A good bug report shouldn't leave others needing to chase you up for more
95
- information. Therefore, we ask you to investigate carefully, collect information
96
- and describe the issue in detail in your report. Please complete the following
97
- steps in advance to help us fix any potential bug as fast as possible.
98
-
99
- - Make sure that you are using the latest version.
100
- - Determine if your bug is really a bug and not an error on your side e.g. using
101
- incompatible environment components/versions (Make sure that you have read the
102
- [documentation](https://prc5.github.io/react-zoom-pan-pinch/). If you are
103
- looking for support, you might want to check
104
- [this section](#i-have-a-question)).
105
- - To see if other users have experienced (and potentially already solved) the
106
- same issue you are having, check if there is not already a bug report existing
107
- for your bug or error in the
108
- [bug tracker](https://github.com/prc5/react-zoom-pan-pinchissues?q=label%3Abug).
109
- - Also make sure to search the internet (including Stack Overflow) to see if
110
- users outside of the GitHub community have discussed the issue.
111
- - Collect information about the bug:
112
- - Stack trace (Traceback)
113
- - OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
114
- - Version of the interpreter, compiler, SDK, runtime environment, package
115
- manager, depending on what seems relevant.
116
- - Possibly your input and the output
117
- - Can you reliably reproduce the issue? And can you also reproduce it with older
118
- versions?
119
-
120
- <!-- omit in toc -->
121
-
122
- #### How Do I Submit a Good Bug Report?
123
-
124
- > You must never report security related issues, vulnerabilities or bugs
125
- > including sensitive information to the issue tracker, or elsewhere in public.
126
- > Instead sensitive bugs must be sent by email to <>.
127
-
128
- <!-- You may add a PGP key to allow the messages to be sent encrypted as well. -->
129
-
130
- We use GitHub issues to track bugs and errors. If you run into an issue with the
131
- project:
132
-
133
- - Open an [Issue](https://github.com/prc5/react-zoom-pan-pinch/issues/new).
134
- (Since we can't be sure at this point whether it is a bug or not, we ask you
135
- not to talk about a bug yet and not to label the issue.)
136
- - Explain the behavior you would expect and the actual behavior.
137
- - Please provide as much context as possible and describe the _reproduction
138
- steps_ that someone else can follow to recreate the issue on their own. This
139
- usually includes your code. For good bug reports you should isolate the
140
- problem and create a reduced test case.
141
- - Provide the information you collected in the previous section.
142
-
143
- Once it's filed:
144
-
145
- - The project team will label the issue accordingly.
146
- - A team member will try to reproduce the issue with your provided steps. If
147
- there are no reproduction steps or no obvious way to reproduce the issue, the
148
- team will ask you for those steps and mark the issue as `needs-repro`. Bugs
149
- with the `needs-repro` tag will not be addressed until they are reproduced.
150
- - If the team is able to reproduce the issue, it will be marked `needs-fix`, as
151
- well as possibly other tags (such as `critical`), and the issue will be left
152
- to be [implemented by someone](#your-first-code-contribution).
153
-
154
- <!-- You might want to create an issue template for bugs and errors that can be used as a guide and that defines the structure of the information to be included. If you do so, reference it here in the description. -->
155
-
156
- ### Suggesting Enhancements
157
-
158
- This section guides you through submitting an enhancement suggestion for Zoom
159
- Pan Pinch, **including completely new features and minor improvements to
160
- existing functionality**. Following these guidelines will help maintainers and
161
- the community to understand your suggestion and find related suggestions.
162
-
163
- <!-- omit in toc -->
164
-
165
- #### Before Submitting an Enhancement
166
-
167
- - Make sure that you are using the latest version.
168
- - Read the [documentation](https://prc5.github.io/react-zoom-pan-pinch/)
169
- carefully and find out if the functionality is already covered, maybe by an
170
- individual configuration.
171
- - Perform a [search](https://github.com/prc5/react-zoom-pan-pinch/issues) to see
172
- if the enhancement has already been suggested. If it has, add a comment to the
173
- existing issue instead of opening a new one.
174
- - Find out whether your idea fits with the scope and aims of the project. It's
175
- up to you to make a strong case to convince the project's developers of the
176
- merits of this feature. Keep in mind that we want features that will be useful
177
- to the majority of our users and not just a small subset. If you're just
178
- targeting a minority of users, consider writing an add-on/plugin library.
179
-
180
- <!-- omit in toc -->
181
-
182
- #### How Do I Submit a Good Enhancement Suggestion?
183
-
184
- Enhancement suggestions are tracked as
185
- [GitHub issues](https://github.com/prc5/react-zoom-pan-pinch/issues).
186
-
187
- - Use a **clear and descriptive title** for the issue to identify the
188
- suggestion.
189
- - Provide a **step-by-step description of the suggested enhancement** in as many
190
- details as possible.
191
- - **Describe the current behavior** and **explain which behavior you expected to
192
- see instead** and why. At this point you can also tell which alternatives do
193
- not work for you.
194
- - You may want to **include screenshots and animated GIFs** which help you
195
- demonstrate the steps or point out the part which the suggestion is related
196
- to.
197
- - **Explain why this enhancement would be useful** to most Zoom Pan Pinch users.
198
- You may also want to point out the other projects that solved it better and
199
- which could serve as inspiration.
200
-
201
- ### Your First Code Contribution
202
-
203
- Checkout
204
- [this tutorial](https://github.com/firstcontributions/first-contributions) of
205
- how to contribute to any project.
206
-
207
- ### Improving The Documentation
208
-
209
- Anyone can help improve the documentation - it is in this repository and is
210
- available to everyone - if you have an idea how to improve it - send us a pull
211
- request and we will try to consider it as soon as possible!
212
-
213
- ## Styleguides
214
-
215
- Each contribution must meet the conditions of our linter and formatter. When
216
- these criteria are not met, the creator will get the appropriate status from
217
- github actions, if issues are not corrected within two weeks, the pull request
218
- will be rejected and closed immediately.
219
-
220
- ### Commit Messages
221
-
222
- Commit messages must follow the
223
- [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard
224
- and present the best possible description of the changes made, which will later
225
- be automatically placed in the release notes. They must not contain curses or
226
- offensive sentences.
227
-
228
- ## Join The Project Team
229
-
230
- Do you want to have a greater impact on the development of the library? Get in
231
- touch with us!
232
-
233
- ## Attribution
234
-
235
- This guide is based on the **contributing-gen**.
236
- [Make your own](https://github.com/bttger/contributing-gen)!
@@ -1,11 +0,0 @@
1
- import { renderExample } from "../shared/render.shared";
2
-
3
- describe("Library components", () => {
4
- describe("When library components have been rendered", () => {
5
- test("it renders transform component without errors", () => {
6
- const { content, wrapper } = renderExample();
7
- expect(content).toBeDefined();
8
- expect(wrapper).toBeDefined();
9
- });
10
- });
11
- });
@@ -1,36 +0,0 @@
1
- import { renderExample } from "../shared/render.shared";
2
-
3
- describe("Example view", () => {
4
- describe("When example view has been rendered", () => {
5
- test("it renders entire example without errors", () => {
6
- const { wrapper } = renderExample();
7
-
8
- expect(wrapper).toBeDefined();
9
- });
10
- test("it renders center in button without errors", () => {
11
- const { center } = renderExample();
12
-
13
- expect(center).toBeDefined();
14
- });
15
- test("it renders zoom in button without errors", () => {
16
- const { zoomInBtn } = renderExample();
17
-
18
- expect(zoomInBtn).toBeDefined();
19
- });
20
- test("it renders zoom out button without errors", () => {
21
- const { zoomOutBtn } = renderExample();
22
-
23
- expect(zoomOutBtn).toBeDefined();
24
- });
25
- test("it renders reset button without errors", () => {
26
- const { resetBtn } = renderExample();
27
-
28
- expect(resetBtn).toBeDefined();
29
- });
30
- test("it renders transform component without errors", () => {
31
- const { content } = renderExample();
32
-
33
- expect(content).toBeDefined();
34
- });
35
- });
36
- });
@@ -1,41 +0,0 @@
1
- import React from "react";
2
- import { render, screen } from "@testing-library/react";
3
-
4
- import { ReactZoomPanPinchProps } from "../../src";
5
- import { Example } from "../utils/example";
6
-
7
- export const renderExample = (props?: ReactZoomPanPinchProps) => {
8
- let renders = 0;
9
- let renderPropsValues = {};
10
-
11
- render(
12
- <Example
13
- {...props}
14
- onRender={() => {
15
- renders += 1;
16
- }}
17
- onRenderProps={(ref) => {
18
- renderPropsValues = ref;
19
- }}
20
- />,
21
- );
22
- // controls buttons
23
- const zoomInBtn = screen.getByTestId("zoom-in");
24
- const zoomOutBtn = screen.getByTestId("zoom-out");
25
- const resetBtn = screen.getByTestId("reset");
26
- const center = screen.getByTestId("center");
27
- // containers
28
- const content = screen.getByTestId("content");
29
- const wrapper = screen.getByTestId("wrapper");
30
-
31
- return {
32
- renders,
33
- renderPropsValues,
34
- zoomInBtn,
35
- zoomOutBtn,
36
- resetBtn,
37
- center,
38
- content,
39
- wrapper,
40
- };
41
- };
@@ -1,25 +0,0 @@
1
- import React from "react";
2
-
3
- import { ReactZoomPanPinchContentRef } from "../../src";
4
-
5
- export const Controls: React.FC<ReactZoomPanPinchContentRef> = ({
6
- zoomIn,
7
- zoomOut,
8
- resetTransform,
9
- centerView,
10
- }: ReactZoomPanPinchContentRef) => (
11
- <div>
12
- <button type="button" onClick={() => zoomIn()} data-testid="zoom-in">
13
- Zoom In +
14
- </button>
15
- <button type="button" onClick={() => zoomOut()} data-testid="zoom-out">
16
- Zoom Out -
17
- </button>
18
- <button type="button" onClick={() => resetTransform()} data-testid="reset">
19
- Reset
20
- </button>
21
- <button type="button" onClick={() => centerView()} data-testid="center">
22
- Center
23
- </button>
24
- </div>
25
- );
@@ -1,81 +0,0 @@
1
- import React from "react";
2
-
3
- import {
4
- TransformWrapper,
5
- TransformComponent,
6
- ReactZoomPanPinchProps,
7
- ReactZoomPanPinchContentRef,
8
- } from "../../src";
9
- import { Controls } from "./controls.utils";
10
-
11
- export const Example = (options: {
12
- props?: ReactZoomPanPinchProps;
13
- onRender: () => void;
14
- onRenderProps: (ref: ReactZoomPanPinchContentRef) => void;
15
- }) => {
16
- const { props = {}, onRender, onRenderProps } = options;
17
-
18
- onRender();
19
-
20
- return (
21
- <TransformWrapper {...props}>
22
- {(utils) => (
23
- <div>
24
- {onRenderProps(utils)}
25
- <Controls {...utils} />
26
- <TransformComponent
27
- wrapperProps={
28
- {
29
- "data-testid": "wrapper",
30
- } as React.HTMLAttributes<HTMLDivElement>
31
- }
32
- contentProps={
33
- {
34
- "data-testid": "content",
35
- } as React.HTMLAttributes<HTMLDivElement>
36
- }
37
- wrapperStyle={{
38
- width: "500px",
39
- height: "500px",
40
- maxWidth: "100%",
41
- maxHeight: "calc(100vh - 50px)",
42
- }}
43
- >
44
- <div
45
- style={{ background: "#444", color: "white", padding: "50px" }}
46
- >
47
- <h1>Title</h1>
48
- <h2>Subtitle</h2>
49
- <button
50
- type="button"
51
- onClick={() =>
52
- alert("You can still interact with click events!")
53
- }
54
- >
55
- Click me!
56
- </button>
57
- <p>
58
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
59
- eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
60
- enim ad minim veniam, quis nostrud exercitation ullamco laboris
61
- nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
62
- in reprehenderit in voluptate velit esse cillum dolore eu fugiat
63
- nulla pariatur. Excepteur sint occaecat cupidatat non proident,
64
- sunt in culpa qui officia deserunt mollit anim id est laborum
65
- </p>
66
- <p>
67
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
68
- eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
69
- enim ad minim veniam, quis nostrud exercitation ullamco laboris
70
- nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
71
- in reprehenderit in voluptate velit esse cillum dolore eu fugiat
72
- nulla pariatur. Excepteur sint occaecat cupidatat non proident,
73
- sunt in culpa qui officia deserunt mollit anim id est laborum
74
- </p>
75
- </div>
76
- </TransformComponent>
77
- </div>
78
- )}
79
- </TransformWrapper>
80
- );
81
- };
@@ -1 +0,0 @@
1
- module.exports = { extends: ["@commitlint/config-conventional"] };
package/jest.config.ts DELETED
@@ -1,45 +0,0 @@
1
- import type { Config } from "@jest/types";
2
-
3
- const config: Config.InitialOptions = {
4
- cacheDirectory: "../../node_modules/.cache/rhf/jest",
5
- testEnvironment: "jsdom",
6
- preset: "ts-jest",
7
- testRegex: [".spec.ts"],
8
- roots: ["<rootDir>/node_modules", "<rootDir>/src", "<rootDir>/__tests__"],
9
- coverageProvider: "v8",
10
- coverageReporters: [
11
- ["lcov", { projectRoot: "../.." }],
12
- "clover",
13
- "json",
14
- "text",
15
- ],
16
- collectCoverageFrom: ["<rootDir>/src/**/*.ts", "<rootDir>/src/**/*.tsx"],
17
- coveragePathIgnorePatterns: [
18
- ".spec",
19
- "test",
20
- "tests",
21
- "types",
22
- "constants",
23
- "index.ts",
24
- ".d.ts",
25
- ],
26
- moduleDirectories: ["node_modules", "src"],
27
- transform: {
28
- "^.+\\.tsx?$": [
29
- "ts-jest",
30
- {
31
- tsconfig: "./tsconfig.json",
32
- isolatedModules: true,
33
- },
34
- ],
35
- },
36
- moduleNameMapper: {
37
- "\\.(css|less|scss|sss|styl)$": "<rootDir>/node_modules/jest-css-modules",
38
- },
39
- watchPlugins: [
40
- "jest-watch-typeahead/filename",
41
- "jest-watch-typeahead/testname",
42
- ],
43
- setupFilesAfterEnv: ["jest-extended/all"],
44
- };
45
- export default config;
package/rollup.config.js DELETED
@@ -1,51 +0,0 @@
1
- import babel from "@rollup/plugin-babel";
2
- import external from "rollup-plugin-peer-deps-external";
3
- import del from "rollup-plugin-delete";
4
- import typescript from "@rollup/plugin-typescript";
5
- import postcss from "rollup-plugin-postcss";
6
- import dts from "rollup-plugin-dts";
7
- import pkg from "./package.json";
8
-
9
- export default [
10
- {
11
- input: pkg.source,
12
- output: [
13
- {
14
- file: pkg.main,
15
- format: "cjs",
16
- exports: "named",
17
- sourcemap: true,
18
- },
19
- {
20
- file: pkg.module,
21
- format: "es",
22
- exports: "named",
23
- sourcemap: true,
24
- },
25
- ],
26
- plugins: [
27
- external(),
28
- babel({
29
- exclude: "node_modules/**",
30
- }),
31
- del({ targets: ["dist/*"] }),
32
- typescript(),
33
- postcss({
34
- modules: true,
35
- }),
36
- ],
37
- external: Object.keys(pkg.peerDependencies || {}),
38
- },
39
- {
40
- input: pkg.source,
41
- output: [{ file: pkg.types, format: "es" }],
42
- plugins: [
43
- external(),
44
- dts({
45
- compilerOptions: {
46
- baseUrl: "./src",
47
- },
48
- }),
49
- ],
50
- },
51
- ];
package/tsconfig.json DELETED
@@ -1,32 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "./dist/",
4
- "module": "esnext",
5
- "target": "es5",
6
- "sourceMap": true,
7
- "allowJs": false,
8
- "jsx": "react",
9
- "declaration": true,
10
- "moduleResolution": "node",
11
- "forceConsistentCasingInFileNames": true,
12
- "noImplicitReturns": true,
13
- "noImplicitThis": true,
14
- "noImplicitAny": true,
15
- "strictNullChecks": true,
16
- "suppressImplicitAnyIndexErrors": true,
17
- "noUnusedLocals": true,
18
- "noUnusedParameters": true,
19
- "allowSyntheticDefaultImports": true,
20
- "baseUrl": "src",
21
- "lib": ["dom", "dom.iterable", "esnext"],
22
- "skipLibCheck": true,
23
- "esModuleInterop": true,
24
- "strict": true,
25
- "noFallthroughCasesInSwitch": true,
26
- "resolveJsonModule": true,
27
- "isolatedModules": true,
28
- "noEmit": true
29
- },
30
- "include": ["src", "__tests__"],
31
- "exclude": ["node_modules", "build", "dist", "rollup.config.js"]
32
- }