├── .circleci └── config.yml ├── .github └── FUNDING.yml ├── .gitignore ├── .mocharc.json ├── .npmignore ├── .releaserc.yml ├── CODE-OF-CONDUCT.md ├── LICENSE-APACHE-2.0 ├── LICENSE-MIT ├── README.md ├── __snapshots__ └── package.test.js ├── babel.config.js ├── declarations └── index.d.ts ├── examples ├── all.html ├── graph3d.html ├── network.html └── timeline.html ├── generate-examples-index.json ├── legacy-files └── img │ └── network │ ├── acceptDeleteIcon.png │ ├── addNodeIcon.png │ ├── backIcon.png │ ├── connectIcon.png │ ├── cross.png │ ├── cross2.png │ ├── deleteIcon.png │ ├── downArrow.png │ ├── editIcon.png │ ├── leftArrow.png │ ├── minus.png │ ├── plus.png │ ├── rightArrow.png │ ├── upArrow.png │ └── zoomExtends.png ├── lib └── header.js ├── package-lock.json ├── package.json ├── renovate.json ├── rollup.build.js ├── src ├── deprecated │ ├── DOMutil.js │ ├── hammer.js │ └── moment.js ├── entry-esnext.js ├── entry-peer.js ├── entry-standalone.js └── legacy-exports.js └── test └── package.test.js /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | executors: 4 | node: 5 | docker: 6 | - image: cimg/node:21.7.3-browsers 7 | working_directory: ~/repo 8 | environment: 9 | GIT_AUTHOR_EMAIL: visjsbot@gmail.com 10 | GIT_AUTHOR_NAME: vis-bot 11 | GIT_COMMITTER_EMAIL: visjsbot@gmail.com 12 | GIT_COMMITTER_NAME: vis-bot 13 | 14 | jobs: 15 | prepare: 16 | executor: node 17 | 18 | steps: 19 | - checkout 20 | 21 | - run: npm ci 22 | 23 | - persist_to_workspace: 24 | root: . 25 | paths: 26 | - '*' 27 | 28 | build: 29 | executor: node 30 | 31 | steps: 32 | - attach_workspace: 33 | at: . 34 | 35 | - run: npm run build 36 | 37 | - persist_to_workspace: 38 | root: . 39 | paths: 40 | - declarations 41 | - dist 42 | - esnext 43 | - peer 44 | - standalone 45 | - styles 46 | 47 | test_unit: 48 | executor: node 49 | 50 | steps: 51 | - attach_workspace: 52 | at: .. 53 | 54 | - run: npm run test:unit 55 | 56 | examples: 57 | executor: node 58 | 59 | steps: 60 | - attach_workspace: 61 | at: . 62 | 63 | - run: npm run generate-examples-index 64 | 65 | - persist_to_workspace: 66 | root: . 67 | paths: 68 | - "examples" 69 | 70 | release: 71 | executor: node 72 | 73 | steps: 74 | - attach_workspace: 75 | at: . 76 | 77 | - run: 78 | name: Prepare NPM 79 | command: | 80 | npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN 81 | 82 | - run: 83 | name: Release 84 | command: | 85 | npx semantic-release 86 | 87 | workflows: 88 | version: 2 89 | 90 | build: 91 | jobs: 92 | - prepare 93 | 94 | - build: 95 | requires: 96 | - prepare 97 | 98 | - test_unit: 99 | requires: 100 | - build 101 | 102 | - examples: 103 | requires: 104 | - build 105 | 106 | - release: 107 | requires: 108 | - prepare 109 | - build 110 | - examples 111 | - test_unit 112 | filters: 113 | branches: 114 | only: 115 | - master 116 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: visjs 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 | custom: # Replace with a single custom sponsorship URL 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # npm files 2 | node_modules 3 | npm-debug.log 4 | 5 | # ide or system files 6 | .idea 7 | .c9 8 | *.iml 9 | .project 10 | .settings/ 11 | .directory 12 | 13 | # temporary files 14 | .*.sw[op] 15 | .commits.tmp 16 | gen/ 17 | .nyc_output/ 18 | coverage/ 19 | report.*.json 20 | vis-charts-*.tgz 21 | /.rpt2_cache/ 22 | /declarations/ 23 | /dist/ 24 | /esnext/ 25 | /examples/examples.css 26 | /examples/generated/ 27 | /examples/index.html 28 | /peer/ 29 | /standalone/ 30 | /styles/ 31 | -------------------------------------------------------------------------------- /.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": [ "js"], 3 | "require": ["vis-dev-utils/babel-register"], 4 | "spec": ["./test/**/*.test.js"] 5 | } 6 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | misc 2 | node_modules 3 | test 4 | tools 5 | .idea 6 | bower.json 7 | Jakefile.js 8 | .npmignore 9 | .gitignore 10 | -------------------------------------------------------------------------------- /.releaserc.yml: -------------------------------------------------------------------------------- 1 | branch: master 2 | plugins: 3 | - '@semantic-release/commit-analyzer' 4 | - '@semantic-release/release-notes-generator' 5 | - '@semantic-release/npm' 6 | - '@semantic-release/github' 7 | -------------------------------------------------------------------------------- /CODE-OF-CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 26 | * Trolling, insulting/derogatory comments, and personal or political attacks 27 | * Public or private harassment 28 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 29 | * Other conduct which could reasonably be considered inappropriate in a professional setting 30 | 31 | ## Our Responsibilities 32 | 33 | Project maintainers are responsible for clarifying the standards of acceptable 34 | behavior and are expected to take appropriate and fair corrective action in 35 | response to any instances of unacceptable behavior. 36 | 37 | Project maintainers have the right and responsibility to remove, edit, or 38 | reject comments, commits, code, wiki edits, issues, and other contributions 39 | that are not aligned to this Code of Conduct, or to ban temporarily or 40 | permanently any contributor for other behaviors that they deem inappropriate, 41 | threatening, offensive, or harmful. 42 | 43 | ## Scope 44 | 45 | This Code of Conduct applies both within project spaces and in public spaces 46 | when an individual is representing the project or its community. Examples of 47 | representing a project or community include using an official project e-mail 48 | address, posting via an official social media account, or acting as an appointed 49 | representative at an online or offline event. Representation of a project may be 50 | further defined and clarified by project maintainers. 51 | 52 | ## Enforcement 53 | 54 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 55 | reported by contacting the project team at james@james.am. All 56 | complaints will be reviewed and investigated and will result in a response that 57 | is deemed necessary and appropriate to the circumstances. The project team is 58 | obligated to maintain confidentiality with regard to the reporter of an incident. 59 | Further details of specific enforcement policies may be posted separately. 60 | 61 | Project maintainers who do not follow or enforce the Code of Conduct in good 62 | faith may face temporary or permanent repercussions as determined by other 63 | members of the project's leadership. 64 | 65 | ## Attribution 66 | 67 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 68 | available at [http://contributor-covenant.org/version/1/4][version] 69 | 70 | [homepage]: http://contributor-covenant.org 71 | [version]: http://contributor-covenant.org/version/1/4/ -------------------------------------------------------------------------------- /LICENSE-APACHE-2.0: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2017 Almende B.V. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vis-charts 2 | 3 | **This is mostly (same export structure) a "plug'n & play replacement" for [vis](https://github.com/almende/vis), wich is no longer maintained** 4 | 5 | Vis.js is a dynamic, browser based visualization library. 6 | The library is designed to be easy to use, handle large amounts 7 | of dynamic data, and enable manipulation of the data. 8 | The library consists of the following components: 9 | 10 | - [DataSet and DataView](https://github.com/visjs/vis-data). A flexible key/value based data set. Add, update, and 11 | remove items. Subscribe on changes in the data set. A DataSet can filter and 12 | order items, and convert fields of items. A filtered and/or formatted view on a DataSet. 13 | - [Network](https://github.com/visjs/vis-network). Display a network (force directed graph) with nodes and edges. 14 | - [Timeline and Graph2d](https://github.com/visjs/vis-timeline). Display different types of data on a timeline. 15 | - [Graph3d](https://github.com/visjs/vis-graph3d). Display data in a three dimensional graph. 16 | 17 | This repository bundles multiple libraries: 18 | 19 | - [vis-data](//github.com/visjs/vis-data) 20 | - [vis-network](//github.com/visjs/vis-network) 21 | - [vis-timeline](//github.com/visjs/vis-timeline) 22 | - [vis-graph3d](//github.com/visjs/vis-graph3d) 23 | 24 | It also includes other external libraries: 25 | 26 | - [moment.js](//www.npmjs.com/package/moment) 27 | - [@egjs/hammerjs](//www.npmjs.com/package/@egjs/hammerjs) 28 | - [keycharm](//www.npmjs.com/package/keycharm) 29 | - [timsort](//www.npmjs.com/package/timsort) 30 | - _and some propably more..._ 31 | 32 | ## Badges 33 | 34 | [![Backers on Open Collective](https://opencollective.com/visjs/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/visjs/sponsors/badge.svg)](#sponsors) 35 | 36 | ## Usage 37 | 38 | :warning: **This library is very big and should better not be used! Please use one of the libraries from the [visjs family](//github.com/visjs) instead!** 39 | 40 | If you really want to, you can replace your old `almende/vis@4.12` files with our new one (replace `latest` by a specific version to prevent unexpected updates): 41 | 42 | ```html 43 | 44 | 45 | ``` 46 | 47 | ## Contribute 48 | 49 | Contributions to the [visjs libraries](https://github.com/visjs) are very welcome! We can't do this alone! 50 | 51 | ### Backers 52 | 53 | Thank you to all our backers! 🙏 54 | 55 | 56 | 57 | ### Sponsors 58 | 59 | Support this project by becoming a sponsor. Your logo will show up here with a link to your website. 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | ## License 73 | 74 | Copyright (c) 2014-2017 Almende B.V. and contributors 75 | Copyright (c) 2017-2020 vis.js contributors 76 | 77 | Vis.js is dual licensed under both 78 | 79 | * The Apache 2.0 License 80 | http://www.apache.org/licenses/LICENSE-2.0 81 | 82 | and 83 | 84 | * The MIT License 85 | http://opensource.org/licenses/MIT 86 | 87 | Vis.js may be distributed under either license. 88 | -------------------------------------------------------------------------------- /__snapshots__/package.test.js: -------------------------------------------------------------------------------- 1 | exports['Package Exported files 1'] = { 2 | "name": "vis-charts ", 3 | "files": [ 4 | " LICENSE-APACHE-2.0", 5 | " LICENSE-MIT", 6 | " README.md", 7 | " declarations/index.d.ts", 8 | " dist/img/network/acceptDeleteIcon.png", 9 | " dist/img/network/addNodeIcon.png", 10 | " dist/img/network/backIcon.png", 11 | " dist/img/network/connectIcon.png", 12 | " dist/img/network/cross.png", 13 | " dist/img/network/cross2.png", 14 | " dist/img/network/deleteIcon.png", 15 | " dist/img/network/downArrow.png", 16 | " dist/img/network/editIcon.png", 17 | " dist/img/network/leftArrow.png", 18 | " dist/img/network/minus.png", 19 | " dist/img/network/plus.png", 20 | " dist/img/network/rightArrow.png", 21 | " dist/img/network/upArrow.png", 22 | " dist/img/network/zoomExtends.png", 23 | " dist/vis.css", 24 | " dist/vis.css.map", 25 | " dist/vis.js", 26 | " dist/vis.js.map", 27 | " dist/vis.min.css", 28 | " dist/vis.min.css.map", 29 | " dist/vis.min.js", 30 | " dist/vis.min.js.map", 31 | " esnext/esm/index.d.ts", 32 | " esnext/esm/index.js", 33 | " esnext/esm/vis-charts.d.ts", 34 | " esnext/esm/vis-charts.js", 35 | " esnext/esm/vis-charts.js.map", 36 | " esnext/esm/vis-charts.min.d.ts", 37 | " esnext/esm/vis-charts.min.js", 38 | " esnext/esm/vis-charts.min.js.map", 39 | " esnext/index.d.ts", 40 | " esnext/index.js", 41 | " esnext/umd/index.d.ts", 42 | " esnext/umd/index.js", 43 | " esnext/umd/vis-charts.d.ts", 44 | " esnext/umd/vis-charts.js", 45 | " esnext/umd/vis-charts.js.map", 46 | " esnext/umd/vis-charts.min.d.ts", 47 | " esnext/umd/vis-charts.min.js", 48 | " esnext/umd/vis-charts.min.js.map", 49 | " package.json", 50 | " peer/esm/index.d.ts", 51 | " peer/esm/index.js", 52 | " peer/esm/vis-charts.d.ts", 53 | " peer/esm/vis-charts.js", 54 | " peer/esm/vis-charts.js.map", 55 | " peer/esm/vis-charts.min.d.ts", 56 | " peer/esm/vis-charts.min.js", 57 | " peer/esm/vis-charts.min.js.map", 58 | " peer/index.d.ts", 59 | " peer/index.js", 60 | " peer/umd/index.d.ts", 61 | " peer/umd/index.js", 62 | " peer/umd/vis-charts.d.ts", 63 | " peer/umd/vis-charts.js", 64 | " peer/umd/vis-charts.js.map", 65 | " peer/umd/vis-charts.min.d.ts", 66 | " peer/umd/vis-charts.min.js", 67 | " peer/umd/vis-charts.min.js.map", 68 | " standalone/esm/index.d.ts", 69 | " standalone/esm/index.js", 70 | " standalone/esm/vis-charts.d.ts", 71 | " standalone/esm/vis-charts.js", 72 | " standalone/esm/vis-charts.js.map", 73 | " standalone/esm/vis-charts.min.d.ts", 74 | " standalone/esm/vis-charts.min.js", 75 | " standalone/esm/vis-charts.min.js.map", 76 | " standalone/index.d.ts", 77 | " standalone/index.js", 78 | " standalone/umd/index.d.ts", 79 | " standalone/umd/index.js", 80 | " standalone/umd/vis-charts.d.ts", 81 | " standalone/umd/vis-charts.js", 82 | " standalone/umd/vis-charts.js.map", 83 | " standalone/umd/vis-charts.min.d.ts", 84 | " standalone/umd/vis-charts.min.js", 85 | " standalone/umd/vis-charts.min.js.map", 86 | " styles/vis-charts.css", 87 | " styles/vis-charts.css.map", 88 | " styles/vis-charts.min.css", 89 | " styles/vis-charts.min.css.map" 90 | ] 91 | } 92 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | exclude: require("vis-dev-utils").BABEL_IGNORE_RE, 3 | presets: [["vis-dev-utils/babel-preset", { css: true }]] 4 | }; 5 | -------------------------------------------------------------------------------- /declarations/index.d.ts: -------------------------------------------------------------------------------- 1 | export const advice = 2 | "Please, don't use this with TypeScript. Use the individual packages, thanks."; 3 | -------------------------------------------------------------------------------- /examples/all.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Charts | All 5 | 6 | 7 | 8 | 9 | 19 | 20 | 21 |

Network

22 |
23 | 24 | 54 | 55 |

Timeline

56 |
57 | 58 | 80 | 81 |

Graph2D

82 |
83 | 84 | 104 | 105 |

Graph3D

106 |
107 | 108 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /examples/graph3d.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Charts | Graph3D 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 | 17 |
18 |
19 | 20 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /examples/network.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Charts | Network 5 | 6 | 7 | 8 | 9 | 16 | 17 | 18 | 19 |

20 | Create a simple network with some nodes and edges. 21 |

22 | 23 |
24 | 25 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /examples/timeline.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Charts | Timeline 5 | 6 | 7 | 8 | 9 | 10 | 11 |

12 | A basic timeline. You can move and zoom the timeline, and select items. 13 |

14 | 15 |
16 | 17 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /generate-examples-index.json: -------------------------------------------------------------------------------- 1 | { 2 | "base-url": "https://visjs.github.io/vis-charts/", 3 | "output-directory": "./examples", 4 | 5 | "assets-local-directory": "./examples/generated", 6 | "assets-web-directory": "./generated", 7 | "examples-local-directory": "./examples", 8 | "examples-web-directory": "./", 9 | "pages-local-directory": "./examples/generated", 10 | "pages-web-directory": "../generated", 11 | 12 | "index": true, 13 | "lint": true, 14 | "playgrounds": true, 15 | "screenshots": true, 16 | 17 | "container-id": "chart", 18 | "format": "html", 19 | "parallel": 6, 20 | "title": "Vis Charts Examples", 21 | "verify": 100 22 | } 23 | -------------------------------------------------------------------------------- /legacy-files/img/network/acceptDeleteIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/acceptDeleteIcon.png -------------------------------------------------------------------------------- /legacy-files/img/network/addNodeIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/addNodeIcon.png -------------------------------------------------------------------------------- /legacy-files/img/network/backIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/backIcon.png -------------------------------------------------------------------------------- /legacy-files/img/network/connectIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/connectIcon.png -------------------------------------------------------------------------------- /legacy-files/img/network/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/cross.png -------------------------------------------------------------------------------- /legacy-files/img/network/cross2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/cross2.png -------------------------------------------------------------------------------- /legacy-files/img/network/deleteIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/deleteIcon.png -------------------------------------------------------------------------------- /legacy-files/img/network/downArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/downArrow.png -------------------------------------------------------------------------------- /legacy-files/img/network/editIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/editIcon.png -------------------------------------------------------------------------------- /legacy-files/img/network/leftArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/leftArrow.png -------------------------------------------------------------------------------- /legacy-files/img/network/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/minus.png -------------------------------------------------------------------------------- /legacy-files/img/network/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/plus.png -------------------------------------------------------------------------------- /legacy-files/img/network/rightArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/rightArrow.png -------------------------------------------------------------------------------- /legacy-files/img/network/upArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/upArrow.png -------------------------------------------------------------------------------- /legacy-files/img/network/zoomExtends.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/visjs/vis-charts/897319f514f8574ef555be3e3a5022418b890936/legacy-files/img/network/zoomExtends.png -------------------------------------------------------------------------------- /lib/header.js: -------------------------------------------------------------------------------- 1 | import moment from "moment"; 2 | import pkg from "../package.json"; 3 | 4 | const header = ` 5 | ${pkg.homepage} 6 | 7 | ${pkg.description} 8 | 9 | @version ${pkg.version} 10 | @date ${moment() 11 | .utc() 12 | .format()} 13 | 14 | @copyright (c) 2011-2017 Almende B.V, http://almende.com 15 | @copyright (c) 2018-2019 visjs contributors, https://github.com/visjs 16 | 17 | @license 18 | vis.js is dual licensed under both 19 | 20 | 1. The Apache 2.0 License 21 | http://www.apache.org/licenses/LICENSE-2.0 22 | 23 | and 24 | 25 | 2. The MIT License 26 | http://opensource.org/licenses/MIT 27 | 28 | vis.js may be distributed under either license.`; 29 | 30 | /** 31 | * Generate a dynamic header banner. 32 | * 33 | * @param {String} component 34 | * @returns {String} banner 35 | */ 36 | function genHeader(component) { 37 | return ( 38 | "/*\n" + 39 | [pkg.name, component ? " - " + component : "", header] 40 | .join("") 41 | .replace(/^(?!\n)/gm, " * ") 42 | .replace(/^(?=\n)/gm, " *") + 43 | "\n */" 44 | ); 45 | } 46 | 47 | export default genHeader; 48 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vis-charts", 3 | "version": "0.0.0-no-version", 4 | "description": "A dynamic, browser-based visualization library.", 5 | "homepage": "http://visjs.org/", 6 | "license": "(Apache-2.0 OR MIT)", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/visjs/vis-charts.git" 10 | }, 11 | "keywords": [ 12 | "vis", 13 | "visualization", 14 | "web based", 15 | "browser based", 16 | "javascript", 17 | "chart", 18 | "linechart", 19 | "timeline", 20 | "graph", 21 | "network", 22 | "browser" 23 | ], 24 | "browser": "peer/umd/vis-charts.min.js", 25 | "jsnext": "esnext/esm/vis-charts.js", 26 | "main": "peer/umd/vis-charts.js", 27 | "module": "peer/esm/vis-charts.js", 28 | "types": "declarations/index.d.ts", 29 | "files": [ 30 | "LICENSE*", 31 | "declarations", 32 | "dist", 33 | "esnext", 34 | "peer", 35 | "standalone", 36 | "styles" 37 | ], 38 | "funding": { 39 | "type": "opencollective", 40 | "url": "https://opencollective.com/visjs" 41 | }, 42 | "scripts": { 43 | "build": "run-s \"build:rollup\" \"build:copy\"", 44 | "build:copy": "shx mkdir -p \"./dist\" && run-p \"build:copy:*\"", 45 | "build:copy:images": "shx cp -r \"./legacy-files/*\" \"./dist/\"", 46 | "build:copy:vis.css": "shx cp \"./styles/vis-charts.css\" \"./dist/vis.css\"", 47 | "build:copy:vis.css.map": "shx cp \"./styles/vis-charts.css.map\" \"./dist/vis.css.map\"", 48 | "build:copy:vis.js": "shx cp \"./peer/umd/vis-charts.js\" \"./dist/vis.js\"", 49 | "build:copy:vis.js.map": "shx cp \"./peer/umd/vis-charts.js.map\" \"./dist/vis.js.map\"", 50 | "build:copy:vis.min.css": "shx cp \"./styles/vis-charts.min.css\" \"./dist/vis.min.css\"", 51 | "build:copy:vis.min.css.map": "shx cp \"./styles/vis-charts.min.css.map\" \"./dist/vis.min.css.map\"", 52 | "build:copy:vis.min.js": "shx cp \"./peer/umd/vis-charts.min.js\" \"./dist/vis.min.js\"", 53 | "build:copy:vis.min.js.map": "shx cp \"./peer/umd/vis-charts.min.js.map\" \"./dist/vis.min.js.map\"", 54 | "build:rollup": "rollup --bundleConfigAsCjs --config rollup.build.js", 55 | "clean": "shx rm -rf \"./{dist,esnext,peer,standalone,styles}/*\"", 56 | "generate-examples-index": "generate-examples-index --config generate-examples-index.json", 57 | "test": "npm run test:unit", 58 | "test:unit": "mocha --exit" 59 | }, 60 | "devDependencies": { 61 | "@egjs/hammerjs": "2.0.17", 62 | "component-emitter": "1.3.1", 63 | "hammerjs": "2.0.8", 64 | "keycharm": "0.4.0", 65 | "mocha": "10.8.1", 66 | "moment": "2.30.1", 67 | "npm-run-all": "4.1.5", 68 | "propagating-hammerjs": "2.0.1", 69 | "snap-shot-it": "7.9.10", 70 | "shx": "0.4.0", 71 | "uuid": "9.0.1", 72 | "vis-data": "7.1.9", 73 | "vis-dev-utils": "4.0.45", 74 | "vis-graph3d": "6.0.7", 75 | "vis-network": "9.1.10", 76 | "vis-timeline": "7.7.4", 77 | "vis-util": "5.0.7" 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["config:base"], 3 | "packageRules": [ 4 | { 5 | "updateTypes": ["minor", "patch", "pin", "digest"], 6 | "automerge": true 7 | } 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /rollup.build.js: -------------------------------------------------------------------------------- 1 | import packageJSON from "./package.json"; 2 | import { generateRollupConfiguration } from "vis-dev-utils"; 3 | 4 | // Note: This is used only for simplicity of maintenance. Only the "peer" build 5 | // is going to be used and it won't have any peer dependencies. 6 | export default generateRollupConfiguration({ 7 | externalForPeerBuild: [], 8 | globals: {}, 9 | header: { name: "vis-charts" }, 10 | libraryFilename: "vis-charts", 11 | entryPoints: "./src", 12 | packageJSON 13 | }); 14 | -------------------------------------------------------------------------------- /src/deprecated/DOMutil.js: -------------------------------------------------------------------------------- 1 | // DOM utility methods 2 | 3 | /** 4 | * this prepares the JSON container for allocating SVG elements 5 | * @param {Object} JSONcontainer 6 | * @private 7 | */ 8 | export function prepareElements(JSONcontainer) { 9 | // cleanup the redundant svgElements; 10 | for (var elementType in JSONcontainer) { 11 | if (JSONcontainer.hasOwnProperty(elementType)) { 12 | JSONcontainer[elementType].redundant = JSONcontainer[elementType].used; 13 | JSONcontainer[elementType].used = []; 14 | } 15 | } 16 | } 17 | 18 | /** 19 | * this cleans up all the unused SVG elements. By asking for the parentNode, we only need to supply the JSON container from 20 | * which to remove the redundant elements. 21 | * 22 | * @param {Object} JSONcontainer 23 | * @private 24 | */ 25 | export function cleanupElements(JSONcontainer) { 26 | // cleanup the redundant svgElements; 27 | for (var elementType in JSONcontainer) { 28 | if (JSONcontainer.hasOwnProperty(elementType)) { 29 | if (JSONcontainer[elementType].redundant) { 30 | for (var i = 0; i < JSONcontainer[elementType].redundant.length; i++) { 31 | JSONcontainer[elementType].redundant[i].parentNode.removeChild( 32 | JSONcontainer[elementType].redundant[i] 33 | ); 34 | } 35 | JSONcontainer[elementType].redundant = []; 36 | } 37 | } 38 | } 39 | } 40 | 41 | /** 42 | * Ensures that all elements are removed first up so they can be recreated cleanly 43 | * @param {Object} JSONcontainer 44 | */ 45 | export function resetElements(JSONcontainer) { 46 | prepareElements(JSONcontainer); 47 | cleanupElements(JSONcontainer); 48 | prepareElements(JSONcontainer); 49 | } 50 | 51 | /** 52 | * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer 53 | * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. 54 | * 55 | * @param {string} elementType 56 | * @param {Object} JSONcontainer 57 | * @param {Object} svgContainer 58 | * @returns {Element} 59 | * @private 60 | */ 61 | export function getSVGElement(elementType, JSONcontainer, svgContainer) { 62 | var element; 63 | // allocate SVG element, if it doesnt yet exist, create one. 64 | if (JSONcontainer.hasOwnProperty(elementType)) { 65 | // this element has been created before 66 | // check if there is an redundant element 67 | if (JSONcontainer[elementType].redundant.length > 0) { 68 | element = JSONcontainer[elementType].redundant[0]; 69 | JSONcontainer[elementType].redundant.shift(); 70 | } else { 71 | // create a new element and add it to the SVG 72 | element = document.createElementNS( 73 | "http://www.w3.org/2000/svg", 74 | elementType 75 | ); 76 | svgContainer.appendChild(element); 77 | } 78 | } else { 79 | // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. 80 | element = document.createElementNS( 81 | "http://www.w3.org/2000/svg", 82 | elementType 83 | ); 84 | JSONcontainer[elementType] = { used: [], redundant: [] }; 85 | svgContainer.appendChild(element); 86 | } 87 | JSONcontainer[elementType].used.push(element); 88 | return element; 89 | } 90 | 91 | /** 92 | * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer 93 | * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. 94 | * 95 | * @param {string} elementType 96 | * @param {Object} JSONcontainer 97 | * @param {Element} DOMContainer 98 | * @param {Element} insertBefore 99 | * @returns {*} 100 | */ 101 | export function getDOMElement( 102 | elementType, 103 | JSONcontainer, 104 | DOMContainer, 105 | insertBefore 106 | ) { 107 | var element; 108 | // allocate DOM element, if it doesnt yet exist, create one. 109 | if (JSONcontainer.hasOwnProperty(elementType)) { 110 | // this element has been created before 111 | // check if there is an redundant element 112 | if (JSONcontainer[elementType].redundant.length > 0) { 113 | element = JSONcontainer[elementType].redundant[0]; 114 | JSONcontainer[elementType].redundant.shift(); 115 | } else { 116 | // create a new element and add it to the SVG 117 | element = document.createElement(elementType); 118 | if (insertBefore !== undefined) { 119 | DOMContainer.insertBefore(element, insertBefore); 120 | } else { 121 | DOMContainer.appendChild(element); 122 | } 123 | } 124 | } else { 125 | // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. 126 | element = document.createElement(elementType); 127 | JSONcontainer[elementType] = { used: [], redundant: [] }; 128 | if (insertBefore !== undefined) { 129 | DOMContainer.insertBefore(element, insertBefore); 130 | } else { 131 | DOMContainer.appendChild(element); 132 | } 133 | } 134 | JSONcontainer[elementType].used.push(element); 135 | return element; 136 | } 137 | 138 | /** 139 | * Draw a point object. This is a separate function because it can also be called by the legend. 140 | * The reason the JSONcontainer and the target SVG svgContainer have to be supplied is so the legend can use these functions 141 | * as well. 142 | * 143 | * @param {number} x 144 | * @param {number} y 145 | * @param {Object} groupTemplate: A template containing the necessary information to draw the datapoint e.g., {style: 'circle', size: 5, className: 'className' } 146 | * @param {Object} JSONcontainer 147 | * @param {Object} svgContainer 148 | * @param {Object} labelObj 149 | * @returns {vis.PointItem} 150 | */ 151 | export function drawPoint( 152 | x, 153 | y, 154 | groupTemplate, 155 | JSONcontainer, 156 | svgContainer, 157 | labelObj 158 | ) { 159 | var point; 160 | if (groupTemplate.style == "circle") { 161 | point = getSVGElement("circle", JSONcontainer, svgContainer); 162 | point.setAttributeNS(null, "cx", x); 163 | point.setAttributeNS(null, "cy", y); 164 | point.setAttributeNS(null, "r", 0.5 * groupTemplate.size); 165 | } else { 166 | point = getSVGElement("rect", JSONcontainer, svgContainer); 167 | point.setAttributeNS(null, "x", x - 0.5 * groupTemplate.size); 168 | point.setAttributeNS(null, "y", y - 0.5 * groupTemplate.size); 169 | point.setAttributeNS(null, "width", groupTemplate.size); 170 | point.setAttributeNS(null, "height", groupTemplate.size); 171 | } 172 | 173 | if (groupTemplate.styles !== undefined) { 174 | point.setAttributeNS(null, "style", groupTemplate.styles); 175 | } 176 | point.setAttributeNS(null, "class", groupTemplate.className + " vis-point"); 177 | //handle label 178 | 179 | if (labelObj) { 180 | var label = getSVGElement("text", JSONcontainer, svgContainer); 181 | if (labelObj.xOffset) { 182 | x = x + labelObj.xOffset; 183 | } 184 | 185 | if (labelObj.yOffset) { 186 | y = y + labelObj.yOffset; 187 | } 188 | if (labelObj.content) { 189 | label.textContent = labelObj.content; 190 | } 191 | 192 | if (labelObj.className) { 193 | label.setAttributeNS(null, "class", labelObj.className + " vis-label"); 194 | } 195 | label.setAttributeNS(null, "x", x); 196 | label.setAttributeNS(null, "y", y); 197 | } 198 | 199 | return point; 200 | } 201 | 202 | /** 203 | * draw a bar SVG element centered on the X coordinate 204 | * 205 | * @param {number} x 206 | * @param {number} y 207 | * @param {number} width 208 | * @param {number} height 209 | * @param {string} className 210 | * @param {Object} JSONcontainer 211 | * @param {Object} svgContainer 212 | * @param {string} style 213 | */ 214 | export function drawBar( 215 | x, 216 | y, 217 | width, 218 | height, 219 | className, 220 | JSONcontainer, 221 | svgContainer, 222 | style 223 | ) { 224 | if (height != 0) { 225 | if (height < 0) { 226 | height *= -1; 227 | y -= height; 228 | } 229 | var rect = getSVGElement("rect", JSONcontainer, svgContainer); 230 | rect.setAttributeNS(null, "x", x - 0.5 * width); 231 | rect.setAttributeNS(null, "y", y); 232 | rect.setAttributeNS(null, "width", width); 233 | rect.setAttributeNS(null, "height", height); 234 | rect.setAttributeNS(null, "class", className); 235 | if (style) { 236 | rect.setAttributeNS(null, "style", style); 237 | } 238 | } 239 | } 240 | 241 | /** 242 | * get default language 243 | * @returns {string} 244 | */ 245 | export function getNavigatorLanguage() { 246 | try { 247 | if (!navigator) return "en"; 248 | if (navigator.languages && navigator.languages.length) { 249 | return navigator.languages; 250 | } else { 251 | return ( 252 | navigator.userLanguage || 253 | navigator.language || 254 | navigator.browserLanguage || 255 | "en" 256 | ); 257 | } 258 | } catch (error) { 259 | return "en"; 260 | } 261 | } 262 | -------------------------------------------------------------------------------- /src/deprecated/hammer.js: -------------------------------------------------------------------------------- 1 | import PropagatingHammer from "propagating-hammerjs"; 2 | import Hammer from "@egjs/hammerjs"; 3 | 4 | /** 5 | * Setup a mock hammer.js object, for unit testing. 6 | * 7 | * Inspiration: https://github.com/uber/deck.gl/pull/658 8 | * 9 | * @returns {{on: noop, off: noop, destroy: noop, emit: noop, get: get}} 10 | */ 11 | function hammerMock() { 12 | const noop = () => {}; 13 | 14 | return { 15 | on: noop, 16 | off: noop, 17 | destroy: noop, 18 | emit: noop, 19 | 20 | get(m) { 21 | //eslint-disable-line no-unused-vars 22 | return { 23 | set: noop 24 | }; 25 | } 26 | }; 27 | } 28 | 29 | let modifiedHammer; 30 | 31 | if (typeof window !== "undefined") { 32 | const OurHammer = window["Hammer"] || Hammer; 33 | modifiedHammer = PropagatingHammer(OurHammer, { 34 | preventDefault: "mouse" 35 | }); 36 | } else { 37 | modifiedHammer = () => 38 | // hammer.js is only available in a browser, not in node.js. Replacing it with a mock object. 39 | hammerMock(); 40 | } 41 | 42 | export default modifiedHammer; 43 | -------------------------------------------------------------------------------- /src/deprecated/moment.js: -------------------------------------------------------------------------------- 1 | // first check if moment.js is already loaded in the browser window, if so, 2 | // use this instance. Else, load via commonjs. 3 | // 4 | // Note: This doesn't work in ESM. 5 | module.exports = 6 | (typeof window !== "undefined" && window["moment"]) || require("moment"); 7 | -------------------------------------------------------------------------------- /src/entry-esnext.js: -------------------------------------------------------------------------------- 1 | export * from "./legacy-exports"; 2 | -------------------------------------------------------------------------------- /src/entry-peer.js: -------------------------------------------------------------------------------- 1 | export * from "./legacy-exports"; 2 | -------------------------------------------------------------------------------- /src/entry-standalone.js: -------------------------------------------------------------------------------- 1 | export * from "./legacy-exports"; 2 | -------------------------------------------------------------------------------- /src/legacy-exports.js: -------------------------------------------------------------------------------- 1 | const defaultExport = {}; 2 | 3 | /* 4 | * Simply export them all. It's pretty much the same as loading all of them 5 | * using script tags in HTML. 6 | */ 7 | 8 | export * from "vis-data/esnext"; 9 | import * as nsData from "vis-data/esnext"; 10 | Object.assign(defaultExport, nsData); 11 | 12 | export * from "vis-graph3d/esnext"; 13 | import * as nsGraph3d from "vis-graph3d/esnext"; 14 | Object.assign(defaultExport, nsGraph3d); 15 | 16 | export * from "vis-network/esnext"; 17 | import * as nsNetwork from "vis-network/esnext"; 18 | Object.assign(defaultExport, nsNetwork); 19 | 20 | export * from "vis-timeline/esnext"; 21 | import * as nsTimeline from "vis-timeline/esnext"; 22 | Object.assign(defaultExport, nsTimeline); 23 | 24 | /* 25 | * Sideeffects required for all of the functions of individual projects to work. 26 | */ 27 | 28 | import "vis-network/styles/vis-network.css"; 29 | 30 | import "moment/locale/de"; 31 | import "moment/locale/es"; 32 | import "moment/locale/fr"; 33 | import "moment/locale/it"; 34 | import "moment/locale/ja"; 35 | import "moment/locale/nl"; 36 | import "moment/locale/pl"; 37 | import "moment/locale/ru"; 38 | import "moment/locale/uk"; 39 | import "vis-timeline/styles/vis-timeline-graph2d.css"; 40 | 41 | /* 42 | * Restore legacy treeshaking immune network export from Vis Network. 43 | */ 44 | 45 | import { 46 | NetworkImages, 47 | networkDOTParser, 48 | networkGephiParser, 49 | networkOptions, 50 | parseDOTNetwork, 51 | parseGephiNetwork, 52 | } from "vis-network/esnext"; 53 | export const network = { 54 | Images: NetworkImages, 55 | dotparser: networkDOTParser, 56 | gephiParser: networkGephiParser, 57 | allOptions: networkOptions, 58 | convertDot: parseDOTNetwork, 59 | convertGephi: parseGephiNetwork, 60 | }; 61 | defaultExport.network = network; 62 | 63 | /* 64 | * Leak internal helper functions. 65 | */ 66 | 67 | import * as util from "vis-util/esnext"; 68 | export { util }; 69 | defaultExport.util = util; 70 | 71 | import * as DOMutil from "./deprecated/DOMutil"; 72 | export { DOMutil }; 73 | defaultExport.DOMutil = DOMutil; 74 | 75 | /* 76 | * Reexport bundled external libraries. 77 | */ 78 | 79 | import * as moment from "./deprecated/moment"; 80 | export { moment }; 81 | defaultExport.moment = moment; 82 | 83 | import * as Hammer from "./deprecated/hammer"; 84 | export { Hammer }; 85 | defaultExport.Hammer = Hammer; 86 | 87 | import * as keycharm from "keycharm"; 88 | export { keycharm }; 89 | defaultExport.keycharm = keycharm; 90 | 91 | /* 92 | * Default export to cover issues with various ways of importing. 93 | */ 94 | 95 | export default defaultExport; 96 | -------------------------------------------------------------------------------- /test/package.test.js: -------------------------------------------------------------------------------- 1 | import snapshot from "snap-shot-it"; 2 | import { inspectNpmPack } from "vis-dev-utils"; 3 | 4 | describe("Package", function () { 5 | it("Exported files", function () { 6 | this.timeout("5m"); 7 | snapshot(inspectNpmPack()); 8 | }); 9 | }); 10 | --------------------------------------------------------------------------------