├── .Rbuildignore ├── .babelrc ├── .eslintignore ├── .eslintrc ├── .gitignore ├── .npmignore ├── .prettierrc ├── .pylintrc ├── CONTRIBUTING.md ├── DESCRIPTION ├── LICENSE ├── MANIFEST.in ├── NAMESPACE ├── Project.toml ├── R ├── bubble.R └── internal.R ├── README.md ├── _validate_init.py ├── dash_dthree_hooks ├── Bubble.py ├── __init__.py ├── _imports_.py ├── dash_dthree_hooks.min.js ├── dash_dthree_hooks.min.js.map ├── metadata.json └── package-info.json ├── deps ├── dash_dthree_hooks.min.js └── dash_dthree_hooks.min.js.map ├── index.html ├── inst └── deps │ ├── dash_dthree_hooks.min.js │ └── dash_dthree_hooks.min.js.map ├── man └── bubble.Rd ├── package-lock.json ├── package.json ├── pytest.ini ├── requirements.txt ├── review_checklist.md ├── setup.py ├── src ├── DashDthreeHooks.jl ├── bubble.jl ├── demo │ ├── App.js │ └── index.js └── lib │ ├── components │ └── Bubble.jsx │ ├── helpers │ └── Hooks.jsx │ └── index.js ├── tests ├── __init__.py ├── requirements.txt └── test_usage.py ├── usage.py ├── webpack.config.js └── webpack.serve.config.js /.Rbuildignore: -------------------------------------------------------------------------------- 1 | # ignore JS config files/folders 2 | node_modules/ 3 | coverage/ 4 | src/ 5 | lib/ 6 | .babelrc 7 | .builderrc 8 | .eslintrc 9 | .npmignore 10 | .editorconfig 11 | .eslintignore 12 | .prettierrc 13 | .circleci 14 | .github 15 | 16 | # demo folder has special meaning in R 17 | # this should hopefully make it still 18 | # allow for the possibility to make R demos 19 | demo/.*\.js 20 | demo/.*\.html 21 | demo/.*\.css 22 | 23 | # ignore Python files/folders 24 | setup.py 25 | usage.py 26 | setup.py 27 | requirements.txt 28 | MANIFEST.in 29 | CHANGELOG.md 30 | test/ 31 | # CRAN has weird LICENSE requirements 32 | LICENSE.txt 33 | ^.*\.Rproj$ 34 | ^\.Rproj\.user$ 35 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env", "@babel/preset-react"], 3 | "env": { 4 | "production": { 5 | "plugins": ["@babel/plugin-proposal-object-rest-spread", "styled-jsx/babel"] 6 | }, 7 | "development": { 8 | "plugins": ["@babel/plugin-proposal-object-rest-spread", "styled-jsx/babel"] 9 | }, 10 | "test": { 11 | "plugins": ["@babel/plugin-proposal-object-rest-spread", "styled-jsx/babel-test"] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | *.css 2 | registerServiceWorker.js -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["eslint:recommended", "prettier"], 3 | "parser": "babel-eslint", 4 | "parserOptions": { 5 | "ecmaVersion": 6, 6 | "sourceType": "module", 7 | "ecmaFeatures": { 8 | "arrowFunctions": true, 9 | "blockBindings": true, 10 | "classes": true, 11 | "defaultParams": true, 12 | "destructuring": true, 13 | "forOf": true, 14 | "generators": true, 15 | "modules": true, 16 | "templateStrings": true, 17 | "jsx": true 18 | } 19 | }, 20 | "env": { 21 | "browser": true, 22 | "es6": true, 23 | "jasmine": true, 24 | "jest": true, 25 | "node": true 26 | }, 27 | "globals": { 28 | "jest": true 29 | }, 30 | "plugins": [ 31 | "react", 32 | "import" 33 | ], 34 | "rules": { 35 | "accessor-pairs": ["error"], 36 | "block-scoped-var": ["error"], 37 | "consistent-return": ["error"], 38 | "curly": ["error", "all"], 39 | "default-case": ["error"], 40 | "dot-location": ["off"], 41 | "dot-notation": ["error"], 42 | "eqeqeq": ["error"], 43 | "guard-for-in": ["off"], 44 | "import/named": ["off"], 45 | "import/no-duplicates": ["error"], 46 | "import/no-named-as-default": ["error"], 47 | "new-cap": ["error"], 48 | "no-alert": [1], 49 | "no-caller": ["error"], 50 | "no-case-declarations": ["error"], 51 | "no-console": ["off"], 52 | "no-div-regex": ["error"], 53 | "no-dupe-keys": ["error"], 54 | "no-else-return": ["error"], 55 | "no-empty-pattern": ["error"], 56 | "no-eq-null": ["error"], 57 | "no-eval": ["error"], 58 | "no-extend-native": ["error"], 59 | "no-extra-bind": ["error"], 60 | "no-extra-boolean-cast": ["error"], 61 | "no-inline-comments": ["error"], 62 | "no-implicit-coercion": ["error"], 63 | "no-implied-eval": ["error"], 64 | "no-inner-declarations": ["off"], 65 | "no-invalid-this": ["error"], 66 | "no-iterator": ["error"], 67 | "no-labels": ["error"], 68 | "no-lone-blocks": ["error"], 69 | "no-loop-func": ["error"], 70 | "no-multi-str": ["error"], 71 | "no-native-reassign": ["error"], 72 | "no-new": ["error"], 73 | "no-new-func": ["error"], 74 | "no-new-wrappers": ["error"], 75 | "no-param-reassign": ["error"], 76 | "no-process-env": ["warn"], 77 | "no-proto": ["error"], 78 | "no-redeclare": ["error"], 79 | "no-return-assign": ["error"], 80 | "no-script-url": ["error"], 81 | "no-self-compare": ["error"], 82 | "no-sequences": ["error"], 83 | "no-shadow": ["off"], 84 | "no-throw-literal": ["error"], 85 | "no-undefined": ["error"], 86 | "no-unused-expressions": ["error"], 87 | "no-use-before-define": ["error", "nofunc"], 88 | "no-useless-call": ["error"], 89 | "no-useless-concat": ["error"], 90 | "no-with": ["error"], 91 | "prefer-const": ["error"], 92 | "radix": ["error"], 93 | "react/jsx-no-duplicate-props": ["error"], 94 | "react/jsx-no-undef": ["error"], 95 | "react/jsx-uses-react": ["error"], 96 | "react/jsx-uses-vars": ["error"], 97 | "react/no-did-update-set-state": ["error"], 98 | "react/no-direct-mutation-state": ["error"], 99 | "react/no-is-mounted": ["error"], 100 | "react/no-unknown-property": ["error"], 101 | "react/prefer-es6-class": ["error", "always"], 102 | "react/prop-types": "error", 103 | "valid-jsdoc": ["off"], 104 | "yoda": ["error"], 105 | "spaced-comment": ["error", "always", { 106 | "block": { 107 | "exceptions": ["*"] 108 | } 109 | }], 110 | "no-unused-vars": ["error", { 111 | "args": "after-used", 112 | "argsIgnorePattern": "^_", 113 | "caughtErrorsIgnorePattern": "^e$" 114 | }], 115 | "no-magic-numbers": ["error", { 116 | "ignoreArrayIndexes": true, 117 | "ignore": [-1, 0, 1, 2, 3, 100, 10, 0.5] 118 | }], 119 | "no-underscore-dangle": ["off"] 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### VisualStudioCode template 3 | .vscode/* 4 | !.vscode/settings.json 5 | !.vscode/tasks.json 6 | !.vscode/launch.json 7 | !.vscode/extensions.json 8 | ### JetBrains template 9 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 10 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 11 | 12 | # User-specific stuff 13 | .idea/**/workspace.xml 14 | .idea/**/tasks.xml 15 | .idea/**/usage.statistics.xml 16 | .idea/**/dictionaries 17 | .idea/**/shelf 18 | 19 | # Sensitive or high-churn files 20 | .idea/**/dataSources/ 21 | .idea/**/dataSources.ids 22 | .idea/**/dataSources.local.xml 23 | .idea/**/sqlDataSources.xml 24 | .idea/**/dynamic.xml 25 | .idea/**/uiDesigner.xml 26 | .idea/**/dbnavigator.xml 27 | 28 | # Gradle 29 | .idea/**/gradle.xml 30 | .idea/**/libraries 31 | 32 | # Gradle and Maven with auto-import 33 | # When using Gradle or Maven with auto-import, you should exclude module files, 34 | # since they will be recreated, and may cause churn. Uncomment if using 35 | # auto-import. 36 | # .idea/modules.xml 37 | # .idea/*.iml 38 | # .idea/modules 39 | 40 | # CMake 41 | cmake-build-*/ 42 | 43 | # Mongo Explorer plugin 44 | .idea/**/mongoSettings.xml 45 | 46 | # File-based project format 47 | *.iws 48 | 49 | # IntelliJ 50 | out/ 51 | 52 | # mpeltonen/sbt-idea plugin 53 | .idea_modules/ 54 | 55 | # JIRA plugin 56 | atlassian-ide-plugin.xml 57 | 58 | # Cursive Clojure plugin 59 | .idea/replstate.xml 60 | 61 | # Crashlytics plugin (for Android Studio and IntelliJ) 62 | com_crashlytics_export_strings.xml 63 | crashlytics.properties 64 | crashlytics-build.properties 65 | fabric.properties 66 | 67 | # Editor-based Rest Client 68 | .idea/httpRequests 69 | ### Node template 70 | # Logs 71 | logs 72 | *.log 73 | npm-debug.log* 74 | yarn-debug.log* 75 | yarn-error.log* 76 | 77 | # Runtime data 78 | pids 79 | *.pid 80 | *.seed 81 | *.pid.lock 82 | 83 | # Directory for instrumented libs generated by jscoverage/JSCover 84 | lib-cov 85 | 86 | # Coverage directory used by tools like istanbul 87 | coverage 88 | 89 | # nyc test coverage 90 | .nyc_output 91 | 92 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 93 | .grunt 94 | 95 | # Bower dependency directory (https://bower.io/) 96 | bower_components 97 | 98 | # node-waf configuration 99 | .lock-wscript 100 | 101 | # Compiled binary addons (https://nodejs.org/api/addons.html) 102 | build/Release 103 | 104 | # Dependency directories 105 | node_modules/ 106 | jspm_packages/ 107 | 108 | # TypeScript v1 declaration files 109 | typings/ 110 | 111 | # Optional npm cache directory 112 | .npm 113 | 114 | # Optional eslint cache 115 | .eslintcache 116 | 117 | # Optional REPL history 118 | .node_repl_history 119 | 120 | # Output of 'npm pack' 121 | *.tgz 122 | 123 | # Yarn Integrity file 124 | .yarn-integrity 125 | 126 | # dotenv environment variables file 127 | .env 128 | 129 | # parcel-bundler cache (https://parceljs.org/) 130 | .cache 131 | 132 | # next.js build output 133 | .next 134 | 135 | # nuxt.js build output 136 | .nuxt 137 | 138 | # vuepress build output 139 | .vuepress/dist 140 | 141 | # Serverless directories 142 | .serverless 143 | ### Python template 144 | # Byte-compiled / optimized / DLL files 145 | __pycache__/ 146 | *.py[cod] 147 | *$py.class 148 | 149 | # C extensions 150 | *.so 151 | 152 | # Distribution / packaging 153 | .Python 154 | build/ 155 | develop-eggs/ 156 | dist/ 157 | downloads/ 158 | eggs/ 159 | .eggs/ 160 | lib64/ 161 | parts/ 162 | sdist/ 163 | var/ 164 | wheels/ 165 | *.egg-info/ 166 | .installed.cfg 167 | *.egg 168 | MANIFEST 169 | 170 | # PyInstaller 171 | # Usually these files are written by a python script from a template 172 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 173 | *.manifest 174 | *.spec 175 | 176 | # Installer logs 177 | pip-log.txt 178 | pip-delete-this-directory.txt 179 | 180 | # Unit test / coverage reports 181 | htmlcov/ 182 | .tox/ 183 | .coverage 184 | .coverage.* 185 | nosetests.xml 186 | coverage.xml 187 | *.cover 188 | .hypothesis/ 189 | .pytest_cache/ 190 | 191 | # Translations 192 | *.mo 193 | *.pot 194 | 195 | # Django stuff: 196 | local_settings.py 197 | db.sqlite3 198 | 199 | # Flask stuff: 200 | instance/ 201 | .webassets-cache 202 | 203 | # Scrapy stuff: 204 | .scrapy 205 | 206 | # Sphinx documentation 207 | docs/_build/ 208 | 209 | # PyBuilder 210 | target/ 211 | 212 | # Jupyter Notebook 213 | .ipynb_checkpoints 214 | 215 | # pyenv 216 | .python-version 217 | 218 | # celery beat schedule file 219 | celerybeat-schedule 220 | 221 | # SageMath parsed files 222 | *.sage.py 223 | 224 | # Environments 225 | .venv 226 | env/ 227 | venv/ 228 | ENV/ 229 | env.bak/ 230 | venv.bak/ 231 | 232 | # Spyder project settings 233 | .spyderproject 234 | .spyproject 235 | 236 | # Rope project settings 237 | .ropeproject 238 | 239 | # mkdocs documentation 240 | /site 241 | 242 | # mypy 243 | .mypy_cache/ 244 | ### SublimeText template 245 | # Cache files for Sublime Text 246 | *.tmlanguage.cache 247 | *.tmPreferences.cache 248 | *.stTheme.cache 249 | 250 | # Workspace files are user-specific 251 | *.sublime-workspace 252 | 253 | # Project files should be checked into the repository, unless a significant 254 | # proportion of contributors will probably not be using Sublime Text 255 | # *.sublime-project 256 | 257 | # SFTP configuration file 258 | sftp-config.json 259 | 260 | # Package control specific files 261 | Package Control.last-run 262 | Package Control.ca-list 263 | Package Control.ca-bundle 264 | Package Control.system-ca-bundle 265 | Package Control.cache/ 266 | Package Control.ca-certs/ 267 | Package Control.merged-ca-bundle 268 | Package Control.user-ca-bundle 269 | oscrypto-ca-bundle.crt 270 | bh_unicode_properties.cache 271 | 272 | # Sublime-github package stores a github token in this file 273 | # https://packagecontrol.io/packages/sublime-github 274 | GitHub.sublime-settings 275 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | /node_modules 3 | 4 | # testing 5 | /coverage 6 | 7 | # misc 8 | .DS_Store 9 | .env.local 10 | .env.development.local 11 | .env.test.local 12 | .env.production.local 13 | 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # Development folders and files 19 | public 20 | src 21 | scripts 22 | config 23 | .travis.yml 24 | CHANGELOG.md 25 | README.md 26 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4, 3 | "singleQuote": true, 4 | "bracketSpacing": false, 5 | "trailingComma": "es5" 6 | } 7 | -------------------------------------------------------------------------------- /.pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | 3 | # A comma-separated list of package or module names from where C extensions may 4 | # be loaded. Extensions are loading into the active Python interpreter and may 5 | # run arbitrary code 6 | extension-pkg-whitelist= 7 | 8 | # Add files or directories to the blacklist. They should be base names, not 9 | # paths. 10 | ignore=CVS 11 | 12 | # Add files or directories matching the regex patterns to the blacklist. The 13 | # regex matches against base names, not paths. 14 | ignore-patterns= 15 | 16 | # Python code to execute, usually for sys.path manipulation such as 17 | # pygtk.require(). 18 | #init-hook= 19 | 20 | # Use multiple processes to speed up Pylint. 21 | jobs=1 22 | 23 | # List of plugins (as comma separated values of python modules names) to load, 24 | # usually to register additional checkers. 25 | load-plugins= 26 | 27 | # Pickle collected data for later comparisons. 28 | persistent=yes 29 | 30 | # Specify a configuration file. 31 | #rcfile= 32 | 33 | # When enabled, pylint would attempt to guess common misconfiguration and emit 34 | # user-friendly hints instead of false-positive error messages 35 | suggestion-mode=yes 36 | 37 | # Allow loading of arbitrary C extensions. Extensions are imported into the 38 | # active Python interpreter and may run arbitrary code. 39 | unsafe-load-any-extension=no 40 | 41 | 42 | [MESSAGES CONTROL] 43 | 44 | # Only show warnings with the listed confidence levels. Leave empty to show 45 | # all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED 46 | confidence= 47 | 48 | # Disable the message, report, category or checker with the given id(s). You 49 | # can either give multiple identifiers separated by comma (,) or put this 50 | # option multiple times (only on the command line, not in the configuration 51 | # file where it should appear only once).You can also use "--disable=all" to 52 | # disable everything first and then reenable specific checks. For example, if 53 | # you want to run only the similarities checker, you can use "--disable=all 54 | # --enable=similarities". If you want to run only the classes checker, but have 55 | # no Warning level messages displayed, use"--disable=all --enable=classes 56 | # --disable=W" 57 | disable=print-statement, 58 | parameter-unpacking, 59 | unpacking-in-except, 60 | old-raise-syntax, 61 | backtick, 62 | long-suffix, 63 | old-ne-operator, 64 | old-octal-literal, 65 | import-star-module-level, 66 | non-ascii-bytes-literal, 67 | raw-checker-failed, 68 | bad-inline-option, 69 | locally-disabled, 70 | locally-enabled, 71 | file-ignored, 72 | suppressed-message, 73 | useless-suppression, 74 | deprecated-pragma, 75 | apply-builtin, 76 | basestring-builtin, 77 | buffer-builtin, 78 | cmp-builtin, 79 | coerce-builtin, 80 | execfile-builtin, 81 | file-builtin, 82 | long-builtin, 83 | raw_input-builtin, 84 | reduce-builtin, 85 | standarderror-builtin, 86 | unicode-builtin, 87 | xrange-builtin, 88 | coerce-method, 89 | delslice-method, 90 | getslice-method, 91 | setslice-method, 92 | no-absolute-import, 93 | old-division, 94 | dict-iter-method, 95 | dict-view-method, 96 | next-method-called, 97 | metaclass-assignment, 98 | indexing-exception, 99 | raising-string, 100 | reload-builtin, 101 | oct-method, 102 | hex-method, 103 | nonzero-method, 104 | cmp-method, 105 | input-builtin, 106 | round-builtin, 107 | intern-builtin, 108 | unichr-builtin, 109 | map-builtin-not-iterating, 110 | zip-builtin-not-iterating, 111 | range-builtin-not-iterating, 112 | filter-builtin-not-iterating, 113 | using-cmp-argument, 114 | eq-without-hash, 115 | div-method, 116 | idiv-method, 117 | rdiv-method, 118 | exception-message-attribute, 119 | invalid-str-codec, 120 | sys-max-int, 121 | bad-python3-import, 122 | deprecated-string-function, 123 | deprecated-str-translate-call, 124 | deprecated-itertools-function, 125 | deprecated-types-field, 126 | next-method-defined, 127 | dict-items-not-iterating, 128 | dict-keys-not-iterating, 129 | dict-values-not-iterating, 130 | no-member, 131 | missing-docstring, 132 | invalid-name, 133 | redefined-builtin, 134 | wrong-import-order, 135 | too-many-arguments, 136 | too-many-locals, 137 | consider-using-enumerate, 138 | len-as-condition, 139 | too-many-branches, 140 | too-many-statements, 141 | blacklisted-name, 142 | line-too-long, 143 | bare-except, 144 | duplicate-code, 145 | too-many-function-args, 146 | attribute-defined-outside-init, 147 | broad-except 148 | 149 | # Enable the message, report, category or checker with the given id(s). You can 150 | # either give multiple identifier separated by comma (,) or put this option 151 | # multiple time (only on the command line, not in the configuration file where 152 | # it should appear only once). See also the "--disable" option for examples. 153 | enable=c-extension-no-member 154 | 155 | 156 | [REPORTS] 157 | 158 | # Python expression which should return a note less than 10 (10 is the highest 159 | # note). You have access to the variables errors warning, statement which 160 | # respectively contain the number of errors / warnings messages and the total 161 | # number of statements analyzed. This is used by the global evaluation report 162 | # (RP0004). 163 | evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) 164 | 165 | # Template used to display messages. This is a python new-style format string 166 | # used to format the message information. See doc for all details 167 | #msg-template= 168 | 169 | # Set the output format. Available formats are text, parseable, colorized, json 170 | # and msvs (visual studio).You can also give a reporter class, eg 171 | # mypackage.mymodule.MyReporterClass. 172 | output-format=text 173 | 174 | # Tells whether to display a full report or only the messages 175 | reports=no 176 | 177 | # Activate the evaluation score. 178 | score=yes 179 | 180 | 181 | [REFACTORING] 182 | 183 | # Maximum number of nested blocks for function / method body 184 | max-nested-blocks=5 185 | 186 | # Complete name of functions that never returns. When checking for 187 | # inconsistent-return-statements if a never returning function is called then 188 | # it will be considered as an explicit return statement and no message will be 189 | # printed. 190 | never-returning-functions=optparse.Values,sys.exit 191 | 192 | 193 | [BASIC] 194 | 195 | # Naming style matching correct argument names 196 | argument-naming-style=snake_case 197 | 198 | # Regular expression matching correct argument names. Overrides argument- 199 | # naming-style 200 | #argument-rgx= 201 | 202 | # Naming style matching correct attribute names 203 | attr-naming-style=snake_case 204 | 205 | # Regular expression matching correct attribute names. Overrides attr-naming- 206 | # style 207 | #attr-rgx= 208 | 209 | # Bad variable names which should always be refused, separated by a comma 210 | bad-names=foo, 211 | bar, 212 | baz, 213 | toto, 214 | tutu, 215 | tata 216 | 217 | # Naming style matching correct class attribute names 218 | class-attribute-naming-style=any 219 | 220 | # Regular expression matching correct class attribute names. Overrides class- 221 | # attribute-naming-style 222 | #class-attribute-rgx= 223 | 224 | # Naming style matching correct class names 225 | class-naming-style=PascalCase 226 | 227 | # Regular expression matching correct class names. Overrides class-naming-style 228 | #class-rgx= 229 | 230 | # Naming style matching correct constant names 231 | const-naming-style=UPPER_CASE 232 | 233 | # Regular expression matching correct constant names. Overrides const-naming- 234 | # style 235 | #const-rgx= 236 | 237 | # Minimum line length for functions/classes that require docstrings, shorter 238 | # ones are exempt. 239 | docstring-min-length=-1 240 | 241 | # Naming style matching correct function names 242 | function-naming-style=snake_case 243 | 244 | # Regular expression matching correct function names. Overrides function- 245 | # naming-style 246 | #function-rgx= 247 | 248 | # Good variable names which should always be accepted, separated by a comma 249 | good-names=i, 250 | j, 251 | k, 252 | ex, 253 | Run, 254 | _ 255 | 256 | # Include a hint for the correct naming format with invalid-name 257 | include-naming-hint=no 258 | 259 | # Naming style matching correct inline iteration names 260 | inlinevar-naming-style=any 261 | 262 | # Regular expression matching correct inline iteration names. Overrides 263 | # inlinevar-naming-style 264 | #inlinevar-rgx= 265 | 266 | # Naming style matching correct method names 267 | method-naming-style=snake_case 268 | 269 | # Regular expression matching correct method names. Overrides method-naming- 270 | # style 271 | #method-rgx= 272 | 273 | # Naming style matching correct module names 274 | module-naming-style=snake_case 275 | 276 | # Regular expression matching correct module names. Overrides module-naming- 277 | # style 278 | #module-rgx= 279 | 280 | # Colon-delimited sets of names that determine each other's naming style when 281 | # the name regexes allow several styles. 282 | name-group= 283 | 284 | # Regular expression which should only match function or class names that do 285 | # not require a docstring. 286 | no-docstring-rgx=^_ 287 | 288 | # List of decorators that produce properties, such as abc.abstractproperty. Add 289 | # to this list to register other decorators that produce valid properties. 290 | property-classes=abc.abstractproperty 291 | 292 | # Naming style matching correct variable names 293 | variable-naming-style=snake_case 294 | 295 | # Regular expression matching correct variable names. Overrides variable- 296 | # naming-style 297 | #variable-rgx= 298 | 299 | 300 | [FORMAT] 301 | 302 | # Expected format of line ending, e.g. empty (any line ending), LF or CRLF. 303 | expected-line-ending-format= 304 | 305 | # Regexp for a line that is allowed to be longer than the limit. 306 | ignore-long-lines=^\s*(# )??$ 307 | 308 | # Number of spaces of indent required inside a hanging or continued line. 309 | indent-after-paren=4 310 | 311 | # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 312 | # tab). 313 | indent-string=' ' 314 | 315 | # Maximum number of characters on a single line. 316 | max-line-length=100 317 | 318 | # Maximum number of lines in a module 319 | max-module-lines=1000 320 | 321 | # List of optional constructs for which whitespace checking is disabled. `dict- 322 | # separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. 323 | # `trailing-comma` allows a space between comma and closing bracket: (a, ). 324 | # `empty-line` allows space-only lines. 325 | no-space-check=trailing-comma, 326 | dict-separator 327 | 328 | # Allow the body of a class to be on the same line as the declaration if body 329 | # contains single statement. 330 | single-line-class-stmt=no 331 | 332 | # Allow the body of an if to be on the same line as the test if there is no 333 | # else. 334 | single-line-if-stmt=no 335 | 336 | 337 | [LOGGING] 338 | 339 | # Logging modules to check that the string format arguments are in logging 340 | # function parameter format 341 | logging-modules=logging 342 | 343 | 344 | [MISCELLANEOUS] 345 | 346 | # List of note tags to take in consideration, separated by a comma. 347 | notes=FIXME, 348 | XXX, 349 | 350 | 351 | [SIMILARITIES] 352 | 353 | # Ignore comments when computing similarities. 354 | ignore-comments=yes 355 | 356 | # Ignore docstrings when computing similarities. 357 | ignore-docstrings=yes 358 | 359 | # Ignore imports when computing similarities. 360 | ignore-imports=no 361 | 362 | # Minimum lines number of a similarity. 363 | min-similarity-lines=4 364 | 365 | 366 | [SPELLING] 367 | 368 | # Limits count of emitted suggestions for spelling mistakes 369 | max-spelling-suggestions=4 370 | 371 | # Spelling dictionary name. Available dictionaries: none. To make it working 372 | # install python-enchant package. 373 | spelling-dict= 374 | 375 | # List of comma separated words that should not be checked. 376 | spelling-ignore-words= 377 | 378 | # A path to a file that contains private dictionary; one word per line. 379 | spelling-private-dict-file= 380 | 381 | # Tells whether to store unknown words to indicated private dictionary in 382 | # --spelling-private-dict-file option instead of raising a message. 383 | spelling-store-unknown-words=no 384 | 385 | 386 | [TYPECHECK] 387 | 388 | # List of decorators that produce context managers, such as 389 | # contextlib.contextmanager. Add to this list to register other decorators that 390 | # produce valid context managers. 391 | contextmanager-decorators=contextlib.contextmanager 392 | 393 | # List of members which are set dynamically and missed by pylint inference 394 | # system, and so shouldn't trigger E1101 when accessed. Python regular 395 | # expressions are accepted. 396 | generated-members= 397 | 398 | # Tells whether missing members accessed in mixin class should be ignored. A 399 | # mixin class is detected if its name ends with "mixin" (case insensitive). 400 | ignore-mixin-members=yes 401 | 402 | # This flag controls whether pylint should warn about no-member and similar 403 | # checks whenever an opaque object is returned when inferring. The inference 404 | # can return multiple potential results while evaluating a Python object, but 405 | # some branches might not be evaluated, which results in partial inference. In 406 | # that case, it might be useful to still emit no-member and other checks for 407 | # the rest of the inferred objects. 408 | ignore-on-opaque-inference=yes 409 | 410 | # List of class names for which member attributes should not be checked (useful 411 | # for classes with dynamically set attributes). This supports the use of 412 | # qualified names. 413 | ignored-classes=optparse.Values,thread._local,_thread._local 414 | 415 | # List of module names for which member attributes should not be checked 416 | # (useful for modules/projects where namespaces are manipulated during runtime 417 | # and thus existing member attributes cannot be deduced by static analysis. It 418 | # supports qualified module names, as well as Unix pattern matching. 419 | ignored-modules= 420 | 421 | # Show a hint with possible names when a member name was not found. The aspect 422 | # of finding the hint is based on edit distance. 423 | missing-member-hint=yes 424 | 425 | # The minimum edit distance a name should have in order to be considered a 426 | # similar match for a missing member name. 427 | missing-member-hint-distance=1 428 | 429 | # The total number of similar names that should be taken in consideration when 430 | # showing a hint for a missing member. 431 | missing-member-max-choices=1 432 | 433 | 434 | [VARIABLES] 435 | 436 | # List of additional names supposed to be defined in builtins. Remember that 437 | # you should avoid to define new builtins when possible. 438 | additional-builtins= 439 | 440 | # Tells whether unused global variables should be treated as a violation. 441 | allow-global-unused-variables=yes 442 | 443 | # List of strings which can identify a callback function by name. A callback 444 | # name must start or end with one of those strings. 445 | callbacks=cb_, 446 | _cb 447 | 448 | # A regular expression matching the name of dummy variables (i.e. expectedly 449 | # not used). 450 | dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ 451 | 452 | # Argument names that match this expression will be ignored. Default to name 453 | # with leading underscore 454 | ignored-argument-names=_.*|^ignored_|^unused_ 455 | 456 | # Tells whether we should check for unused import in __init__ files. 457 | init-import=no 458 | 459 | # List of qualified module names which can have objects that can redefine 460 | # builtins. 461 | redefining-builtins-modules=six.moves,past.builtins,future.builtins 462 | 463 | 464 | [CLASSES] 465 | 466 | # List of method names used to declare (i.e. assign) instance attributes. 467 | defining-attr-methods=__init__, 468 | __new__, 469 | setUp 470 | 471 | # List of member names, which should be excluded from the protected access 472 | # warning. 473 | exclude-protected=_asdict, 474 | _fields, 475 | _replace, 476 | _source, 477 | _make 478 | 479 | # List of valid names for the first argument in a class method. 480 | valid-classmethod-first-arg=cls 481 | 482 | # List of valid names for the first argument in a metaclass class method. 483 | valid-metaclass-classmethod-first-arg=mcs 484 | 485 | 486 | [DESIGN] 487 | 488 | # Maximum number of arguments for function / method 489 | max-args=5 490 | 491 | # Maximum number of attributes for a class (see R0902). 492 | max-attributes=7 493 | 494 | # Maximum number of boolean expressions in a if statement 495 | max-bool-expr=5 496 | 497 | # Maximum number of branch for function / method body 498 | max-branches=12 499 | 500 | # Maximum number of locals for function / method body 501 | max-locals=15 502 | 503 | # Maximum number of parents for a class (see R0901). 504 | max-parents=7 505 | 506 | # Maximum number of public methods for a class (see R0904). 507 | max-public-methods=20 508 | 509 | # Maximum number of return / yield for function / method body 510 | max-returns=6 511 | 512 | # Maximum number of statements in function / method body 513 | max-statements=50 514 | 515 | # Minimum number of public methods for a class (see R0903). 516 | min-public-methods=2 517 | 518 | 519 | [IMPORTS] 520 | 521 | # Allow wildcard imports from modules that define __all__. 522 | allow-wildcard-with-all=no 523 | 524 | # Analyse import fallback blocks. This can be used to support both Python 2 and 525 | # 3 compatible code, which means that the block might have code that exists 526 | # only in one or another interpreter, leading to false positives when analysed. 527 | analyse-fallback-blocks=no 528 | 529 | # Deprecated modules which should not be used, separated by a comma 530 | deprecated-modules=optparse,tkinter.tix 531 | 532 | # Create a graph of external dependencies in the given file (report RP0402 must 533 | # not be disabled) 534 | ext-import-graph= 535 | 536 | # Create a graph of every (i.e. internal and external) dependencies in the 537 | # given file (report RP0402 must not be disabled) 538 | import-graph= 539 | 540 | # Create a graph of internal dependencies in the given file (report RP0402 must 541 | # not be disabled) 542 | int-import-graph= 543 | 544 | # Force import order to recognize a module as part of the standard 545 | # compatibility libraries. 546 | known-standard-library= 547 | 548 | # Force import order to recognize a module as part of a third party library. 549 | known-third-party=enchant 550 | 551 | 552 | [EXCEPTIONS] 553 | 554 | # Exceptions that will emit a warning when being caught. Defaults to 555 | # "Exception" 556 | overgeneral-exceptions=Exception 557 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # CONTRIBUTING 2 | 3 | This project was generated by the [dash-component-boilerplate](https://github.com/plotly/dash-component-boilerplate) it contains the minimal set of code required to create your own custom Dash component. 4 | 5 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: dashDthreeHooks 2 | Title: Dash custom components using D3 and React Hooks 3 | Version: 0.0.1 4 | Description: Dash custom components using D3 and React Hooks 5 | Depends: R (>= 3.0.2) 6 | Imports: 7 | Suggests: 8 | License: MIT + file LICENSE 9 | URL: 10 | BugReports: 11 | Encoding: UTF-8 12 | LazyData: true 13 | KeepSource: true 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlfsjunior/dash_dthree_hooks/89cfa556c02a3c5b08b53e6e33c7ccc053c82473/LICENSE -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include dash_dthree_hooks/dash_dthree_hooks.min.js 2 | include dash_dthree_hooks/dash_dthree_hooks.min.js.map 3 | include dash_dthree_hooks/metadata.json 4 | include dash_dthree_hooks/package-info.json 5 | include README.md 6 | include LICENSE 7 | include package.json 8 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # AUTO GENERATED FILE - DO NOT EDIT 2 | 3 | export(Bubble) 4 | export(bubble) -------------------------------------------------------------------------------- /Project.toml: -------------------------------------------------------------------------------- 1 | 2 | name = "DashDthreeHooks" 3 | uuid = "1b08a953-4be3-4667-9a23-b947a370dd9c" 4 | authors = ["José Luiz Ferreira "] 5 | version = "0.0.1" 6 | 7 | [deps] 8 | Dash = "1b08a953-4be3-4667-9a23-3db579824955" 9 | 10 | [compat] 11 | julia = "1.2" 12 | Dash = "0.1.3" 13 | -------------------------------------------------------------------------------- /R/bubble.R: -------------------------------------------------------------------------------- 1 | # AUTO GENERATED FILE - DO NOT EDIT 2 | 3 | bubble <- function(id=NULL, width=NULL, height=NULL, data=NULL, clicked=NULL) { 4 | 5 | props <- list(id=id, width=width, height=height, data=data, clicked=clicked) 6 | if (length(props) > 0) { 7 | props <- props[!vapply(props, is.null, logical(1))] 8 | } 9 | component <- list( 10 | props = props, 11 | type = 'Bubble', 12 | namespace = 'dash_dthree_hooks', 13 | propNames = c('id', 'width', 'height', 'data', 'clicked'), 14 | package = 'dashDthreeHooks' 15 | ) 16 | 17 | structure(component, class = c('dash_component', 'list')) 18 | } 19 | -------------------------------------------------------------------------------- /R/internal.R: -------------------------------------------------------------------------------- 1 | .dashDthreeHooks_js_metadata <- function() { 2 | deps_metadata <- list(`dash_dthree_hooks` = structure(list(name = "dash_dthree_hooks", 3 | version = "0.0.1", src = list(href = NULL, 4 | file = "deps"), meta = NULL, 5 | script = 'dash_dthree_hooks.min.js', 6 | stylesheet = NULL, head = NULL, attachment = NULL, package = "dashDthreeHooks", 7 | all_files = FALSE), class = "html_dependency"), 8 | `dash_dthree_hooks` = structure(list(name = "dash_dthree_hooks", 9 | version = "0.0.1", src = list(href = NULL, 10 | file = "deps"), meta = NULL, 11 | script = 'dash_dthree_hooks.min.js.map', 12 | stylesheet = NULL, head = NULL, attachment = NULL, package = "dashDthreeHooks", 13 | all_files = FALSE, dynamic = TRUE), class = "html_dependency")) 14 | return(deps_metadata) 15 | } 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dash dthree hooks 2 | 3 | dash dthree hooks is a Dash component library for charts using D3 and React Hooks. 4 | 5 | For more information on how to create custom components, I refer to the [original Dash documentation](https://dash.plotly.com/plugins). Dash also provides two examples of D3 charts [here](https://dash.plotly.com/d3-react-components), however hooks are not used. 6 | 7 | Big shoutout to [`muratkemaldar`](https://github.com/muratkemaldar/using-react-hooks-with-d3) for the inspiration to use `ResizeObserver` for responsiveness. 8 | ## Usage 9 | 10 | Get started with: 11 | 1. Install Dash and its dependencies: https://dash.plotly.com/installation 12 | 2. Run `python usage.py` 13 | 3. Visit http://localhost:8050 in your web browser 14 | 15 | -------------------------------------------------------------------------------- /_validate_init.py: -------------------------------------------------------------------------------- 1 | """ 2 | DO NOT MODIFY 3 | This file is used to validate your publish settings. 4 | """ 5 | from __future__ import print_function 6 | 7 | import os 8 | import sys 9 | import importlib 10 | 11 | 12 | components_package = 'dash_dthree_hooks' 13 | 14 | components_lib = importlib.import_module(components_package) 15 | 16 | missing_dist_msg = 'Warning {} was not found in `{}.__init__.{}`!!!' 17 | missing_manifest_msg = ''' 18 | Warning {} was not found in `MANIFEST.in`! 19 | It will not be included in the build! 20 | ''' 21 | 22 | with open('MANIFEST.in', 'r') as f: 23 | manifest = f.read() 24 | 25 | 26 | def check_dist(dist, filename): 27 | # Support the dev bundle. 28 | if filename.endswith('dev.js'): 29 | return True 30 | 31 | return any( 32 | filename in x 33 | for d in dist 34 | for x in ( 35 | [d.get('relative_package_path')] 36 | if not isinstance(d.get('relative_package_path'), list) 37 | else d.get('relative_package_path') 38 | ) 39 | ) 40 | 41 | 42 | def check_manifest(filename): 43 | return filename in manifest 44 | 45 | 46 | def check_file(dist, filename): 47 | if not check_dist(dist, filename): 48 | print( 49 | missing_dist_msg.format(filename, components_package, '_js_dist'), 50 | file=sys.stderr 51 | ) 52 | if not check_manifest(filename): 53 | print(missing_manifest_msg.format(filename), 54 | file=sys.stderr) 55 | 56 | 57 | for cur, _, files in os.walk(components_package): 58 | for f in files: 59 | 60 | if f.endswith('js'): 61 | # noinspection PyProtectedMember 62 | check_file(components_lib._js_dist, f) 63 | elif f.endswith('css'): 64 | # noinspection PyProtectedMember 65 | check_file(components_lib._css_dist, f) 66 | elif not f.endswith('py'): 67 | check_manifest(f) 68 | -------------------------------------------------------------------------------- /dash_dthree_hooks/Bubble.py: -------------------------------------------------------------------------------- 1 | # AUTO GENERATED FILE - DO NOT EDIT 2 | 3 | from dash.development.base_component import Component, _explicitize_args 4 | 5 | 6 | class Bubble(Component): 7 | """A Bubble component. 8 | Bubble component using d3 and hooks 9 | 10 | Keyword arguments: 11 | - id (string; optional): The ID used to identify this component in Dash callbacks. 12 | - width (number; optional): Chart width 13 | - height (number; optional): Chart height 14 | - data (list; optional): Data 15 | - clicked (dict; optional): Clicked datum (use in point click callbacks)""" 16 | @_explicitize_args 17 | def __init__(self, id=Component.UNDEFINED, width=Component.UNDEFINED, height=Component.UNDEFINED, data=Component.UNDEFINED, clicked=Component.UNDEFINED, **kwargs): 18 | self._prop_names = ['id', 'width', 'height', 'data', 'clicked'] 19 | self._type = 'Bubble' 20 | self._namespace = 'dash_dthree_hooks' 21 | self._valid_wildcard_attributes = [] 22 | self.available_properties = ['id', 'width', 'height', 'data', 'clicked'] 23 | self.available_wildcard_properties = [] 24 | 25 | _explicit_args = kwargs.pop('_explicit_args') 26 | _locals = locals() 27 | _locals.update(kwargs) # For wildcard attrs 28 | args = {k: _locals[k] for k in _explicit_args if k != 'children'} 29 | 30 | for k in []: 31 | if k not in args: 32 | raise TypeError( 33 | 'Required argument `' + k + '` was not specified.') 34 | super(Bubble, self).__init__(**args) 35 | -------------------------------------------------------------------------------- /dash_dthree_hooks/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function as _ 2 | 3 | import os as _os 4 | import sys as _sys 5 | import json 6 | 7 | import dash as _dash 8 | 9 | # noinspection PyUnresolvedReferences 10 | from ._imports_ import * 11 | from ._imports_ import __all__ 12 | 13 | if not hasattr(_dash, '__plotly_dash') and not hasattr(_dash, 'development'): 14 | print('Dash was not successfully imported. ' 15 | 'Make sure you don\'t have a file ' 16 | 'named \n"dash.py" in your current directory.', file=_sys.stderr) 17 | _sys.exit(1) 18 | 19 | _basepath = _os.path.dirname(__file__) 20 | _filepath = _os.path.abspath(_os.path.join(_basepath, 'package-info.json')) 21 | with open(_filepath) as f: 22 | package = json.load(f) 23 | 24 | package_name = package['name'].replace(' ', '_').replace('-', '_') 25 | __version__ = package['version'] 26 | 27 | _current_path = _os.path.dirname(_os.path.abspath(__file__)) 28 | 29 | _this_module = _sys.modules[__name__] 30 | 31 | 32 | _js_dist = [ 33 | { 34 | 'relative_package_path': 'dash_dthree_hooks.min.js', 35 | 36 | 'namespace': package_name 37 | }, 38 | { 39 | 'relative_package_path': 'dash_dthree_hooks.min.js.map', 40 | 41 | 'namespace': package_name, 42 | 'dynamic': True 43 | } 44 | ] 45 | 46 | _css_dist = [] 47 | 48 | 49 | for _component in __all__: 50 | setattr(locals()[_component], '_js_dist', _js_dist) 51 | setattr(locals()[_component], '_css_dist', _css_dist) 52 | -------------------------------------------------------------------------------- /dash_dthree_hooks/_imports_.py: -------------------------------------------------------------------------------- 1 | from .Bubble import Bubble 2 | 3 | __all__ = [ 4 | "Bubble" 5 | ] -------------------------------------------------------------------------------- /dash_dthree_hooks/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "src/lib/components/Bubble.jsx": { 3 | "description": "Bubble component using d3 and hooks", 4 | "displayName": "Bubble", 5 | "methods": [], 6 | "props": { 7 | "id": { 8 | "type": { 9 | "name": "string" 10 | }, 11 | "required": false, 12 | "description": "The ID used to identify this component in Dash callbacks." 13 | }, 14 | "setProps": { 15 | "type": { 16 | "name": "func" 17 | }, 18 | "required": false, 19 | "description": "Dash-assigned callback that should be called to report property changes\nto Dash, to make them available for callbacks." 20 | }, 21 | "width": { 22 | "type": { 23 | "name": "number" 24 | }, 25 | "required": false, 26 | "description": "Chart width" 27 | }, 28 | "height": { 29 | "type": { 30 | "name": "number" 31 | }, 32 | "required": false, 33 | "description": "Chart height" 34 | }, 35 | "data": { 36 | "type": { 37 | "name": "array" 38 | }, 39 | "required": false, 40 | "description": "Data" 41 | }, 42 | "clicked": { 43 | "type": { 44 | "name": "object" 45 | }, 46 | "required": false, 47 | "description": "Clicked datum (use in point click callbacks)" 48 | } 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /dash_dthree_hooks/package-info.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dash_dthree_hooks", 3 | "version": "0.0.1", 4 | "description": "Dash custom components using D3 and React Hooks", 5 | "main": "build/index.js", 6 | "scripts": { 7 | "start": "webpack-serve --config ./webpack.serve.config.js --open", 8 | "validate-init": "python _validate_init.py", 9 | "prepublishOnly": "npm run validate-init", 10 | "build:js": "webpack --mode production", 11 | "build:backends": "dash-generate-components ./src/lib/components dash_dthree_hooks -p package-info.json --r-prefix '' --jl-prefix ''", 12 | "build:backends-activated": "(. venv/bin/activate || venv\\scripts\\activate && npm run build:py_and_r)", 13 | "build": "npm run build:js && npm run build:backends", 14 | "build:activated": "npm run build:js && npm run build:backends-activated" 15 | }, 16 | "author": "José Luiz Ferreira ", 17 | "license": "MIT", 18 | "dependencies": { 19 | "d3": "^6.5.0", 20 | "ramda": "^0.26.1", 21 | "resize-observer-polyfill": "^1.5.1" 22 | }, 23 | "devDependencies": { 24 | "@babel/core": "^7.5.4", 25 | "@babel/plugin-proposal-object-rest-spread": "^7.5.4", 26 | "@babel/preset-env": "^7.5.4", 27 | "@babel/preset-react": "^7.0.0", 28 | "babel-eslint": "^10.0.2", 29 | "babel-loader": "^8.0.6", 30 | "copyfiles": "^2.1.1", 31 | "css-loader": "^3.0.0", 32 | "eslint": "^6.0.1", 33 | "eslint-config-prettier": "^6.0.0", 34 | "eslint-plugin-import": "^2.18.0", 35 | "eslint-plugin-react": "^7.14.2", 36 | "npm": "^6.1.0", 37 | "prop-types": "^15.7.2", 38 | "react": "^16.8.6", 39 | "react-docgen": "^4.1.1", 40 | "react-dom": "^16.8.6", 41 | "styled-jsx": "^3.2.1", 42 | "style-loader": "^0.23.1", 43 | "webpack": "4.36.1", 44 | "webpack-cli": "3.3.6", 45 | "webpack-serve": "3.1.0" 46 | }, 47 | "engines": { 48 | "node": ">=8.11.0", 49 | "npm": ">=6.1.0" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /deps/dash_dthree_hooks.min.js: -------------------------------------------------------------------------------- 1 | window.dash_dthree_hooks=function(t){var n={};function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(r,i,function(n){return t[n]}.bind(null,i));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=95)}({1:function(t,n){t.exports=window.React},2:function(t,n){t.exports=window.PropTypes},20:function(t,n,e){"use strict";(function(t){var e=function(){if("undefined"!=typeof Map)return Map;function t(t,n){var e=-1;return t.some((function(t,r){return t[0]===n&&(e=r,!0)})),e}return function(){function n(){this.__entries__=[]}return Object.defineProperty(n.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),n.prototype.get=function(n){var e=t(this.__entries__,n),r=this.__entries__[e];return r&&r[1]},n.prototype.set=function(n,e){var r=t(this.__entries__,n);~r?this.__entries__[r][1]=e:this.__entries__.push([n,e])},n.prototype.delete=function(n){var e=this.__entries__,r=t(e,n);~r&&e.splice(r,1)},n.prototype.has=function(n){return!!~t(this.__entries__,n)},n.prototype.clear=function(){this.__entries__.splice(0)},n.prototype.forEach=function(t,n){void 0===n&&(n=null);for(var e=0,r=this.__entries__;e0},t.prototype.connect_=function(){r&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),u?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){r&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(t){var n=t.propertyName,e=void 0===n?"":n;a.some((function(t){return!!~e.indexOf(t)}))&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),c=function(t,n){for(var e=0,r=Object.keys(n);e0},t}(),b="undefined"!=typeof WeakMap?new WeakMap:new e,x=function t(n){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var e=s.getInstance(),r=new w(n,e,this);b.set(this,r)};["observe","unobserve","disconnect"].forEach((function(t){x.prototype[t]=function(){var n;return(n=b.get(this))[t].apply(n,arguments)}}));var M=void 0!==i.ResizeObserver?i.ResizeObserver:x;n.a=M}).call(this,e(94))},94:function(t,n){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},95:function(t,n,e){"use strict";e.r(n);var r=e(1),i=e(2),o=e.n(i),a=e(20);function u(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var e=[],r=!0,i=!1,o=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(e.push(a.value),!n||e.length!==n);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==u.return||u.return()}finally{if(i)throw o}}return e}(t,n)||function(t,n){if(!t)return;if("string"==typeof t)return s(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return s(t,n)}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e=i)&&(e=i)}return e}var l={value:()=>{}};function h(){for(var t,n=0,e=arguments.length,r={};n=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function d(t,n){for(var e,r=0,i=t.length;r0)for(var e,r,i=new Array(e),o=0;on?1:t>=n?0:NaN}var C="http://www.w3.org/1999/xhtml",L={svg:"http://www.w3.org/2000/svg",xhtml:C,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},D=function(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),L.hasOwnProperty(n)?{space:L[n],local:t}:t};function X(t){return function(){this.removeAttribute(t)}}function z(t){return function(){this.removeAttributeNS(t.space,t.local)}}function I(t,n){return function(){this.setAttribute(t,n)}}function B(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function H(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function $(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}var Y=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function V(t){return function(){this.style.removeProperty(t)}}function F(t,n,e){return function(){this.style.setProperty(t,n,e)}}function W(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function G(t,n){return t.style.getPropertyValue(n)||Y(t).getComputedStyle(t,null).getPropertyValue(n)}function U(t){return function(){delete this[t]}}function Q(t,n){return function(){this[t]=n}}function K(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function Z(t){return t.trim().split(/^|\s+/)}function J(t){return t.classList||new tt(t)}function tt(t){this._node=t,this._names=Z(t.getAttribute("class")||"")}function nt(t,n){for(var e=J(t),r=-1,i=n.length;++r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function at(){this.textContent=""}function ut(t){return function(){this.textContent=t}}function st(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function ct(){this.innerHTML=""}function lt(t){return function(){this.innerHTML=t}}function ht(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function ft(){this.nextSibling&&this.parentNode.appendChild(this)}function pt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function dt(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===C&&n.documentElement.namespaceURI===C?n.createElement(t):n.createElementNS(e,t)}}function vt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}var yt=function(t){var n=D(t);return(n.local?vt:dt)(n)};function gt(){return null}function mt(){var t=this.parentNode;t&&t.removeChild(this)}function _t(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function wt(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function bt(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function xt(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r=x&&(x=b+1);!(w=y[x])&&++x=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=q);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?V:"function"==typeof n?W:F)(t,n,null==e?"":e)):G(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?U:"function"==typeof n?K:Q)(t,n)):this.node()[t]},classed:function(t,n){var e=Z(t+"");if(arguments.length<2){for(var r=J(this.node()),i=-1,o=e.length;++i>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Qt(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Qt(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=zt.exec(t))?new Jt(n[1],n[2],n[3],1):(n=It.exec(t))?new Jt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Bt.exec(t))?Qt(n[1],n[2],n[3],n[4]):(n=Ht.exec(t))?Qt(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=$t.exec(t))?rn(n[1],n[2]/100,n[3]/100,1):(n=Yt.exec(t))?rn(n[1],n[2]/100,n[3]/100,n[4]):Vt.hasOwnProperty(t)?Ut(Vt[t]):"transparent"===t?new Jt(NaN,NaN,NaN,0):null}function Ut(t){return new Jt(t>>16&255,t>>8&255,255&t,1)}function Qt(t,n,e,r){return r<=0&&(t=n=e=NaN),new Jt(t,n,e,r)}function Kt(t){return t instanceof qt||(t=Gt(t)),t?new Jt((t=t.rgb()).r,t.g,t.b,t.opacity):new Jt}function Zt(t,n,e,r){return 1===arguments.length?Kt(t):new Jt(t,n,e,null==r?1:r)}function Jt(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function tn(){return"#"+en(this.r)+en(this.g)+en(this.b)}function nn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function en(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function rn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new an(t,n,e,r)}function on(t){if(t instanceof an)return new an(t.h,t.s,t.l,t.opacity);if(t instanceof qt||(t=Gt(t)),!t)return new an;if(t instanceof an)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e0&&s<1?0:a,new an(a,u,s,t.opacity)}function an(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function un(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function sn(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}Rt(qt,Gt,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Ft,formatHex:Ft,formatHsl:function(){return on(this).formatHsl()},formatRgb:Wt,toString:Wt}),Rt(Jt,Zt,Pt(qt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Jt(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Jt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tn,formatHex:tn,formatRgb:nn,toString:nn})),Rt(an,(function(t,n,e,r){return 1===arguments.length?on(t):new an(t,n,e,null==r?1:r)}),Pt(qt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new an(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new an(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Jt(un(t>=240?t-240:t+120,i,r),un(t,i,r),un(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var cn=t=>()=>t;function ln(t,n){return function(e){return t+e*n}}function hn(t){return 1==(t=+t)?fn:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):cn(isNaN(n)?e:n)}}function fn(t,n){var e=n-t;return e?ln(t,e):cn(isNaN(t)?n:t)}var pn=function t(n){var e=hn(n);function r(t,n){var r=e((t=Zt(t)).r,(n=Zt(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=fn(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function dn(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=ro&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:_n(e,r)})),o=xn.lastIndex;return o=0&&n._call.call(null,t),n=n._next;--Nn}()}finally{Nn=0,function(){var t,n,e=Mn,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Mn=n);An=t,Bn(r)}(),Tn=0}}function In(){var t=Pn.now(),n=t-jn;n>1e3&&(Rn-=n,jn=t)}function Bn(t){Nn||(On&&(On=clearTimeout(On)),t-Tn>24?(t<1/0&&(On=setTimeout(zn,t-Pn.now()-Rn)),Sn&&(Sn=clearInterval(Sn))):(Sn||(jn=Pn.now(),Sn=setInterval(In,1e3)),Nn=1,qn(zn)))}Dn.prototype=Xn.prototype={constructor:Dn,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Cn():+e)+(null==n?0:+n),this._next||An===this||(An?An._next=this:Mn=this,An=this),this._call=t,this._time=e,Bn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bn())}};var Hn=function(t,n,e){var r=new Dn;return n=null==n?0:+n,r.restart(e=>{r.stop(),t(e+n)},n,e),r},$n=y("start","end","cancel","interrupt"),Yn=[],Vn=function(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(s){var c,l,h,f;if(1!==e.state)return u();for(c in i)if((f=i[c]).name===e.name){if(3===f.state)return Hn(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[c]):+c0)throw new Error("too late; already scheduled");return e}function Wn(t,n){var e=Gn(t,n);if(e.state>3)throw new Error("too late; already running");return e}function Gn(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}var Un,Qn=function(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}},Kn=180/Math.PI,Zn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Jn=function(t,n,e,r,i,o){var a,u,s;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,s/=u),t*r180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:_n(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,s),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:_n(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,s),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:_n(t,e)},{i:u-2,x:_n(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var n,e=-1,r=s.length;++e=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Fn:Wn;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}var Me=jt.prototype.constructor;function Ae(t){return function(){this.style.removeProperty(t)}}function Ee(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function ke(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&Ee(t,o,e)),r}return o._value=n,o}function Ne(t){return function(n){this.textContent=t.call(this,n)}}function Oe(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&Ne(r)),n}return r._value=t,r}var Se=0;function je(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Te(){return++Se}var Re=jt.prototype;je.prototype=function(t){return jt().transition(t)}.prototype={constructor:je,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=m(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a=0?(o>=Be?10:o>=He?5:o>=$e?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Be?10:o>=He?5:o>=$e?2:1)}var Ve=function(t,n){return tn?1:t>=n?0:NaN},Fe=function(t){let n=t,e=t;function r(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;e(t[o],n)<0?r=o+1:i=o}return r}return 1===t.length&&(n=(n,e)=>t(n)-e,e=function(t){return(n,e)=>Ve(t(n),e)}(t)),{left:r,center:function(t,e,i,o){null==i&&(i=0),null==o&&(o=t.length);const a=r(t,e,i,o-1);return a>i&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;e(t[o],n)>0?i=o:r=o+1}return r}}};const We=Fe(Ve),Ge=We.right;We.left,Fe((function(t){return null===t?NaN:+t})).center;var Ue=Ge,Qe=function(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}};function Ke(t){return+t}var Ze=[0,1];function Je(t){return t}function tr(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:(e=isNaN(n)?NaN:.5,function(){return e});var e}function nr(t,n,e){var r=t[0],i=t[1],o=n[0],a=n[1];return in&&(e=t,t=n,n=e),c=function(e){return Math.max(t,Math.min(n,e))}),r=s>2?er:nr,i=o=null,h}function h(n){return isNaN(n=+n)?e:(i||(i=r(a.map(t),u,s)))(t(c(n)))}return h.invert=function(e){return c(n((o||(o=r(u,a.map(t),_n)))(e)))},h.domain=function(t){return arguments.length?(a=Array.from(t,Ke),l()):a.slice()},h.range=function(t){return arguments.length?(u=Array.from(t),l()):u.slice()},h.rangeRound=function(t){return u=Array.from(t),s=Qe,l()},h.clamp=function(t){return arguments.length?(c=!!t||Je,l()):c!==Je},h.interpolate=function(t){return arguments.length?(s=t,l()):s},h.unknown=function(t){return arguments.length?(e=t,h):e},function(e,r){return t=e,n=r,l()}}function or(){return ir()(Je,Je)}function ar(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}var ur=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function sr(t){if(!(n=ur.exec(t)))throw new Error("invalid format: "+t);var n;return new cr({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function cr(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}sr.prototype=cr.prototype,cr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};function lr(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}var hr,fr,pr,dr,vr=function(t){return(t=lr(Math.abs(t)))?t[1]:NaN},yr=function(t,n){var e=lr(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")},gr={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>yr(100*t,n),r:yr,s:function(t,n){var e=lr(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(hr=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+lr(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)},mr=function(t){return t},_r=Array.prototype.map,wr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];fr=function(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?mr:(n=_r.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?mr:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(_r.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",l=void 0===t.nan?"NaN":t.nan+"";function h(t){var n=(t=sr(t)).fill,e=t.align,h=t.sign,f=t.symbol,p=t.zero,d=t.width,v=t.comma,y=t.precision,g=t.trim,m=t.type;"n"===m?(v=!0,m="g"):gr[m]||(void 0===y&&(y=12),g=!0,m="g"),(p||"0"===n&&"="===e)&&(p=!0,n="0",e="=");var _="$"===f?i:"#"===f&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===f?o:/[%p]/.test(m)?s:"",b=gr[m],x=/[defgprs%]/.test(m);function M(t){var i,o,s,f=_,M=w;if("c"===m)M=b(t)+M,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:b(Math.abs(t),y),g&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),A&&0==+t&&"+"!==h&&(A=!1),f=(A?"("===h?h:c:"-"===h||"("===h?"":h)+f,M=("s"===m?wr[8+hr/3]:"")+M+(A&&"("===h?")":""),x)for(i=-1,o=t.length;++i(s=t.charCodeAt(i))||s>57){M=(46===s?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}v&&!p&&(t=r(t,1/0));var E=f.length+t.length+M.length,k=E>1)+f+t+M+k.slice(E);break;default:t=k+f+t+M}return u(t)}return y=void 0===y?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),M.toString=function(){return t+""},M}return{format:h,formatPrefix:function(t,n){var e=h(((t=sr(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(vr(n)/3))),i=Math.pow(10,-r),o=wr[8+r/3];return function(t){return e(i*t)+o}}}}({thousands:",",grouping:[3],currency:["$",""]}),pr=fr.format,dr=fr.formatPrefix;function br(t,n,e,r){var i,o=function(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=Be?i*=10:o>=He?i*=5:o>=$e&&(i*=2),n0)return[t];if((r=n0)for(t=Math.ceil(t/a),n=Math.floor(n/a),o=new Array(i=Math.ceil(n-t+1));++u0;){if((i=Ye(s,c,e))===r)return o[a]=s,o[u]=c,n(o);if(i>0)s=Math.floor(s/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function Mr(){var t=or();return t.copy=function(){return rr(t,Mr())},ar.apply(t,arguments),xr(t)}function Ar(t){return((t=Math.exp(t))+1/t)/2}(function t(n,e,r){function i(t,i){var o,a,u=t[0],s=t[1],c=t[2],l=i[0],h=i[1],f=i[2],p=l-u,d=h-s,v=p*p+d*d;if(v<1e-12)a=Math.log(f/c)/n,o=function(t){return[u+t*p,s+t*d,c*Math.exp(n*t*a)]};else{var y=Math.sqrt(v),g=(f*f-c*c+r*v)/(2*c*e*y),m=(f*f-c*c-r*v)/(2*f*e*y),_=Math.log(Math.sqrt(g*g+1)-g),w=Math.log(Math.sqrt(m*m+1)-m);a=(w-_)/n,o=function(t){var r,i=t*a,o=Ar(_),l=c/(e*y)*(o*(r=n*i+_,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(_));return[u+l*p,s+l*d,c*o/Ar(n*i+_)]}}return o.duration=1e3*a*n/Math.SQRT2,o}return i.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},i})(Math.SQRT2,2,4);function Er(t,n,e){this.k=t,this.x=n,this.y=e}Er.prototype={constructor:Er,scale:function(t){return 1===t?this:new Er(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new Er(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};new Er(1,0,0);Er.prototype;var kr=function(t){var n=t.id,e=t.setProps,i=t.data,o=(t.clicked,Object(r.useRef)(null)),s=Object(r.useRef)(null),l=function(t){var n=u(Object(r.useState)(null),2),e=n[0],i=n[1];return Object(r.useEffect)((function(){var n=t.current,e=new a.a((function(t){t.forEach((function(t){i(t.contentRect)}))}));return e.observe(n),function(){e.unobserve(n)}}),[t]),e}(s);return Object(r.useEffect)((function(){if(i&&o.current&&l){var t=Tt(o.current).select("g.pointsLayer"),n=Mr().domain([0,c(i,(function(t){return t.x}))]).range([50,l.width-50]),r=Mr().domain([0,c(i,(function(t){return t.y}))]).range([l.height-50,50]),a=Mr().domain(function(t,n){let e,r;if(void 0===n)for(const n of t)null!=n&&(void 0===e?n>=n&&(e=r=n):(e>n&&(e=n),r=o&&(e=r=o):(e>o&&(e=o),r 2 | 3 | 4 | my-dash-component 5 | 6 | 7 |
8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /inst/deps/dash_dthree_hooks.min.js: -------------------------------------------------------------------------------- 1 | window.dash_dthree_hooks=function(t){var n={};function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(r,i,function(n){return t[n]}.bind(null,i));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=95)}({1:function(t,n){t.exports=window.React},2:function(t,n){t.exports=window.PropTypes},20:function(t,n,e){"use strict";(function(t){var e=function(){if("undefined"!=typeof Map)return Map;function t(t,n){var e=-1;return t.some((function(t,r){return t[0]===n&&(e=r,!0)})),e}return function(){function n(){this.__entries__=[]}return Object.defineProperty(n.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),n.prototype.get=function(n){var e=t(this.__entries__,n),r=this.__entries__[e];return r&&r[1]},n.prototype.set=function(n,e){var r=t(this.__entries__,n);~r?this.__entries__[r][1]=e:this.__entries__.push([n,e])},n.prototype.delete=function(n){var e=this.__entries__,r=t(e,n);~r&&e.splice(r,1)},n.prototype.has=function(n){return!!~t(this.__entries__,n)},n.prototype.clear=function(){this.__entries__.splice(0)},n.prototype.forEach=function(t,n){void 0===n&&(n=null);for(var e=0,r=this.__entries__;e0},t.prototype.connect_=function(){r&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),u?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){r&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(t){var n=t.propertyName,e=void 0===n?"":n;a.some((function(t){return!!~e.indexOf(t)}))&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),c=function(t,n){for(var e=0,r=Object.keys(n);e0},t}(),b="undefined"!=typeof WeakMap?new WeakMap:new e,x=function t(n){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var e=s.getInstance(),r=new w(n,e,this);b.set(this,r)};["observe","unobserve","disconnect"].forEach((function(t){x.prototype[t]=function(){var n;return(n=b.get(this))[t].apply(n,arguments)}}));var M=void 0!==i.ResizeObserver?i.ResizeObserver:x;n.a=M}).call(this,e(94))},94:function(t,n){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},95:function(t,n,e){"use strict";e.r(n);var r=e(1),i=e(2),o=e.n(i),a=e(20);function u(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var e=[],r=!0,i=!1,o=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(e.push(a.value),!n||e.length!==n);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==u.return||u.return()}finally{if(i)throw o}}return e}(t,n)||function(t,n){if(!t)return;if("string"==typeof t)return s(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return s(t,n)}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e=i)&&(e=i)}return e}var l={value:()=>{}};function h(){for(var t,n=0,e=arguments.length,r={};n=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function d(t,n){for(var e,r=0,i=t.length;r0)for(var e,r,i=new Array(e),o=0;on?1:t>=n?0:NaN}var C="http://www.w3.org/1999/xhtml",L={svg:"http://www.w3.org/2000/svg",xhtml:C,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},D=function(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),L.hasOwnProperty(n)?{space:L[n],local:t}:t};function X(t){return function(){this.removeAttribute(t)}}function z(t){return function(){this.removeAttributeNS(t.space,t.local)}}function I(t,n){return function(){this.setAttribute(t,n)}}function B(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function H(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function $(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}var Y=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function V(t){return function(){this.style.removeProperty(t)}}function F(t,n,e){return function(){this.style.setProperty(t,n,e)}}function W(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function G(t,n){return t.style.getPropertyValue(n)||Y(t).getComputedStyle(t,null).getPropertyValue(n)}function U(t){return function(){delete this[t]}}function Q(t,n){return function(){this[t]=n}}function K(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function Z(t){return t.trim().split(/^|\s+/)}function J(t){return t.classList||new tt(t)}function tt(t){this._node=t,this._names=Z(t.getAttribute("class")||"")}function nt(t,n){for(var e=J(t),r=-1,i=n.length;++r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function at(){this.textContent=""}function ut(t){return function(){this.textContent=t}}function st(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function ct(){this.innerHTML=""}function lt(t){return function(){this.innerHTML=t}}function ht(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function ft(){this.nextSibling&&this.parentNode.appendChild(this)}function pt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function dt(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===C&&n.documentElement.namespaceURI===C?n.createElement(t):n.createElementNS(e,t)}}function vt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}var yt=function(t){var n=D(t);return(n.local?vt:dt)(n)};function gt(){return null}function mt(){var t=this.parentNode;t&&t.removeChild(this)}function _t(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function wt(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function bt(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function xt(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r=x&&(x=b+1);!(w=y[x])&&++x=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=q);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?V:"function"==typeof n?W:F)(t,n,null==e?"":e)):G(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?U:"function"==typeof n?K:Q)(t,n)):this.node()[t]},classed:function(t,n){var e=Z(t+"");if(arguments.length<2){for(var r=J(this.node()),i=-1,o=e.length;++i>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Qt(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Qt(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=zt.exec(t))?new Jt(n[1],n[2],n[3],1):(n=It.exec(t))?new Jt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Bt.exec(t))?Qt(n[1],n[2],n[3],n[4]):(n=Ht.exec(t))?Qt(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=$t.exec(t))?rn(n[1],n[2]/100,n[3]/100,1):(n=Yt.exec(t))?rn(n[1],n[2]/100,n[3]/100,n[4]):Vt.hasOwnProperty(t)?Ut(Vt[t]):"transparent"===t?new Jt(NaN,NaN,NaN,0):null}function Ut(t){return new Jt(t>>16&255,t>>8&255,255&t,1)}function Qt(t,n,e,r){return r<=0&&(t=n=e=NaN),new Jt(t,n,e,r)}function Kt(t){return t instanceof qt||(t=Gt(t)),t?new Jt((t=t.rgb()).r,t.g,t.b,t.opacity):new Jt}function Zt(t,n,e,r){return 1===arguments.length?Kt(t):new Jt(t,n,e,null==r?1:r)}function Jt(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function tn(){return"#"+en(this.r)+en(this.g)+en(this.b)}function nn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function en(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function rn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new an(t,n,e,r)}function on(t){if(t instanceof an)return new an(t.h,t.s,t.l,t.opacity);if(t instanceof qt||(t=Gt(t)),!t)return new an;if(t instanceof an)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e0&&s<1?0:a,new an(a,u,s,t.opacity)}function an(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function un(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function sn(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}Rt(qt,Gt,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Ft,formatHex:Ft,formatHsl:function(){return on(this).formatHsl()},formatRgb:Wt,toString:Wt}),Rt(Jt,Zt,Pt(qt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Jt(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Jt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tn,formatHex:tn,formatRgb:nn,toString:nn})),Rt(an,(function(t,n,e,r){return 1===arguments.length?on(t):new an(t,n,e,null==r?1:r)}),Pt(qt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new an(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new an(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Jt(un(t>=240?t-240:t+120,i,r),un(t,i,r),un(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var cn=t=>()=>t;function ln(t,n){return function(e){return t+e*n}}function hn(t){return 1==(t=+t)?fn:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):cn(isNaN(n)?e:n)}}function fn(t,n){var e=n-t;return e?ln(t,e):cn(isNaN(t)?n:t)}var pn=function t(n){var e=hn(n);function r(t,n){var r=e((t=Zt(t)).r,(n=Zt(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=fn(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function dn(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=ro&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:_n(e,r)})),o=xn.lastIndex;return o=0&&n._call.call(null,t),n=n._next;--Nn}()}finally{Nn=0,function(){var t,n,e=Mn,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Mn=n);An=t,Bn(r)}(),Tn=0}}function In(){var t=Pn.now(),n=t-jn;n>1e3&&(Rn-=n,jn=t)}function Bn(t){Nn||(On&&(On=clearTimeout(On)),t-Tn>24?(t<1/0&&(On=setTimeout(zn,t-Pn.now()-Rn)),Sn&&(Sn=clearInterval(Sn))):(Sn||(jn=Pn.now(),Sn=setInterval(In,1e3)),Nn=1,qn(zn)))}Dn.prototype=Xn.prototype={constructor:Dn,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Cn():+e)+(null==n?0:+n),this._next||An===this||(An?An._next=this:Mn=this,An=this),this._call=t,this._time=e,Bn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bn())}};var Hn=function(t,n,e){var r=new Dn;return n=null==n?0:+n,r.restart(e=>{r.stop(),t(e+n)},n,e),r},$n=y("start","end","cancel","interrupt"),Yn=[],Vn=function(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(s){var c,l,h,f;if(1!==e.state)return u();for(c in i)if((f=i[c]).name===e.name){if(3===f.state)return Hn(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[c]):+c0)throw new Error("too late; already scheduled");return e}function Wn(t,n){var e=Gn(t,n);if(e.state>3)throw new Error("too late; already running");return e}function Gn(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}var Un,Qn=function(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}},Kn=180/Math.PI,Zn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Jn=function(t,n,e,r,i,o){var a,u,s;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,s/=u),t*r180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:_n(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,s),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:_n(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,s),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:_n(t,e)},{i:u-2,x:_n(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var n,e=-1,r=s.length;++e=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Fn:Wn;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}var Me=jt.prototype.constructor;function Ae(t){return function(){this.style.removeProperty(t)}}function Ee(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function ke(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&Ee(t,o,e)),r}return o._value=n,o}function Ne(t){return function(n){this.textContent=t.call(this,n)}}function Oe(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&Ne(r)),n}return r._value=t,r}var Se=0;function je(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Te(){return++Se}var Re=jt.prototype;je.prototype=function(t){return jt().transition(t)}.prototype={constructor:je,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=m(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a=0?(o>=Be?10:o>=He?5:o>=$e?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Be?10:o>=He?5:o>=$e?2:1)}var Ve=function(t,n){return tn?1:t>=n?0:NaN},Fe=function(t){let n=t,e=t;function r(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;e(t[o],n)<0?r=o+1:i=o}return r}return 1===t.length&&(n=(n,e)=>t(n)-e,e=function(t){return(n,e)=>Ve(t(n),e)}(t)),{left:r,center:function(t,e,i,o){null==i&&(i=0),null==o&&(o=t.length);const a=r(t,e,i,o-1);return a>i&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;e(t[o],n)>0?i=o:r=o+1}return r}}};const We=Fe(Ve),Ge=We.right;We.left,Fe((function(t){return null===t?NaN:+t})).center;var Ue=Ge,Qe=function(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}};function Ke(t){return+t}var Ze=[0,1];function Je(t){return t}function tr(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:(e=isNaN(n)?NaN:.5,function(){return e});var e}function nr(t,n,e){var r=t[0],i=t[1],o=n[0],a=n[1];return in&&(e=t,t=n,n=e),c=function(e){return Math.max(t,Math.min(n,e))}),r=s>2?er:nr,i=o=null,h}function h(n){return isNaN(n=+n)?e:(i||(i=r(a.map(t),u,s)))(t(c(n)))}return h.invert=function(e){return c(n((o||(o=r(u,a.map(t),_n)))(e)))},h.domain=function(t){return arguments.length?(a=Array.from(t,Ke),l()):a.slice()},h.range=function(t){return arguments.length?(u=Array.from(t),l()):u.slice()},h.rangeRound=function(t){return u=Array.from(t),s=Qe,l()},h.clamp=function(t){return arguments.length?(c=!!t||Je,l()):c!==Je},h.interpolate=function(t){return arguments.length?(s=t,l()):s},h.unknown=function(t){return arguments.length?(e=t,h):e},function(e,r){return t=e,n=r,l()}}function or(){return ir()(Je,Je)}function ar(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}var ur=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function sr(t){if(!(n=ur.exec(t)))throw new Error("invalid format: "+t);var n;return new cr({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function cr(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}sr.prototype=cr.prototype,cr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};function lr(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}var hr,fr,pr,dr,vr=function(t){return(t=lr(Math.abs(t)))?t[1]:NaN},yr=function(t,n){var e=lr(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")},gr={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>yr(100*t,n),r:yr,s:function(t,n){var e=lr(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(hr=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+lr(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)},mr=function(t){return t},_r=Array.prototype.map,wr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];fr=function(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?mr:(n=_r.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?mr:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(_r.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",l=void 0===t.nan?"NaN":t.nan+"";function h(t){var n=(t=sr(t)).fill,e=t.align,h=t.sign,f=t.symbol,p=t.zero,d=t.width,v=t.comma,y=t.precision,g=t.trim,m=t.type;"n"===m?(v=!0,m="g"):gr[m]||(void 0===y&&(y=12),g=!0,m="g"),(p||"0"===n&&"="===e)&&(p=!0,n="0",e="=");var _="$"===f?i:"#"===f&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===f?o:/[%p]/.test(m)?s:"",b=gr[m],x=/[defgprs%]/.test(m);function M(t){var i,o,s,f=_,M=w;if("c"===m)M=b(t)+M,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:b(Math.abs(t),y),g&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),A&&0==+t&&"+"!==h&&(A=!1),f=(A?"("===h?h:c:"-"===h||"("===h?"":h)+f,M=("s"===m?wr[8+hr/3]:"")+M+(A&&"("===h?")":""),x)for(i=-1,o=t.length;++i(s=t.charCodeAt(i))||s>57){M=(46===s?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}v&&!p&&(t=r(t,1/0));var E=f.length+t.length+M.length,k=E>1)+f+t+M+k.slice(E);break;default:t=k+f+t+M}return u(t)}return y=void 0===y?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),M.toString=function(){return t+""},M}return{format:h,formatPrefix:function(t,n){var e=h(((t=sr(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(vr(n)/3))),i=Math.pow(10,-r),o=wr[8+r/3];return function(t){return e(i*t)+o}}}}({thousands:",",grouping:[3],currency:["$",""]}),pr=fr.format,dr=fr.formatPrefix;function br(t,n,e,r){var i,o=function(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=Be?i*=10:o>=He?i*=5:o>=$e&&(i*=2),n0)return[t];if((r=n0)for(t=Math.ceil(t/a),n=Math.floor(n/a),o=new Array(i=Math.ceil(n-t+1));++u0;){if((i=Ye(s,c,e))===r)return o[a]=s,o[u]=c,n(o);if(i>0)s=Math.floor(s/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function Mr(){var t=or();return t.copy=function(){return rr(t,Mr())},ar.apply(t,arguments),xr(t)}function Ar(t){return((t=Math.exp(t))+1/t)/2}(function t(n,e,r){function i(t,i){var o,a,u=t[0],s=t[1],c=t[2],l=i[0],h=i[1],f=i[2],p=l-u,d=h-s,v=p*p+d*d;if(v<1e-12)a=Math.log(f/c)/n,o=function(t){return[u+t*p,s+t*d,c*Math.exp(n*t*a)]};else{var y=Math.sqrt(v),g=(f*f-c*c+r*v)/(2*c*e*y),m=(f*f-c*c-r*v)/(2*f*e*y),_=Math.log(Math.sqrt(g*g+1)-g),w=Math.log(Math.sqrt(m*m+1)-m);a=(w-_)/n,o=function(t){var r,i=t*a,o=Ar(_),l=c/(e*y)*(o*(r=n*i+_,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(_));return[u+l*p,s+l*d,c*o/Ar(n*i+_)]}}return o.duration=1e3*a*n/Math.SQRT2,o}return i.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},i})(Math.SQRT2,2,4);function Er(t,n,e){this.k=t,this.x=n,this.y=e}Er.prototype={constructor:Er,scale:function(t){return 1===t?this:new Er(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new Er(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};new Er(1,0,0);Er.prototype;var kr=function(t){var n=t.id,e=t.setProps,i=t.data,o=(t.clicked,Object(r.useRef)(null)),s=Object(r.useRef)(null),l=function(t){var n=u(Object(r.useState)(null),2),e=n[0],i=n[1];return Object(r.useEffect)((function(){var n=t.current,e=new a.a((function(t){t.forEach((function(t){i(t.contentRect)}))}));return e.observe(n),function(){e.unobserve(n)}}),[t]),e}(s);return Object(r.useEffect)((function(){if(i&&o.current&&l){var t=Tt(o.current).select("g.pointsLayer"),n=Mr().domain([0,c(i,(function(t){return t.x}))]).range([50,l.width-50]),r=Mr().domain([0,c(i,(function(t){return t.y}))]).range([l.height-50,50]),a=Mr().domain(function(t,n){let e,r;if(void 0===n)for(const n of t)null!=n&&(void 0===e?n>=n&&(e=r=n):(e>n&&(e=n),r=o&&(e=r=o):(e>o&&(e=o),r", 17 | "license": "MIT", 18 | "dependencies": { 19 | "d3": "^6.5.0", 20 | "ramda": "^0.26.1", 21 | "resize-observer-polyfill": "^1.5.1" 22 | }, 23 | "devDependencies": { 24 | "@babel/core": "^7.5.4", 25 | "@babel/plugin-proposal-object-rest-spread": "^7.5.4", 26 | "@babel/preset-env": "^7.5.4", 27 | "@babel/preset-react": "^7.0.0", 28 | "babel-eslint": "^10.0.2", 29 | "babel-loader": "^8.0.6", 30 | "copyfiles": "^2.1.1", 31 | "css-loader": "^3.0.0", 32 | "eslint": "^6.0.1", 33 | "eslint-config-prettier": "^6.0.0", 34 | "eslint-plugin-import": "^2.18.0", 35 | "eslint-plugin-react": "^7.14.2", 36 | "npm": "^6.1.0", 37 | "prop-types": "^15.7.2", 38 | "react": "^16.8.6", 39 | "react-docgen": "^4.1.1", 40 | "react-dom": "^16.8.6", 41 | "styled-jsx": "^3.2.1", 42 | "style-loader": "^0.23.1", 43 | "webpack": "4.36.1", 44 | "webpack-cli": "3.3.6", 45 | "webpack-serve": "3.1.0" 46 | }, 47 | "engines": { 48 | "node": ">=8.11.0", 49 | "npm": ">=6.1.0" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | testpaths = tests/ 3 | addopts = -rsxX -vv 4 | log_format = %(asctime)s | %(levelname)s | %(name)s:%(lineno)d | %(message)s 5 | log_cli_level = ERROR 6 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # dash is required to call `build:py` 2 | dash[dev]>=1.15.0 3 | -------------------------------------------------------------------------------- /review_checklist.md: -------------------------------------------------------------------------------- 1 | # Code Review Checklist 2 | 3 | ## Code quality & design 4 | 5 | - Is your code clear? If you had to go back to it in a month, would you be happy to? If someone else had to contribute to it, would they be able to? 6 | 7 | A few suggestions: 8 | 9 | - Make your variable names descriptive and use the same naming conventions throughout the code. 10 | 11 | - For more complex pieces of logic, consider putting a comment, and maybe an example. 12 | 13 | - In the comments, focus on describing _why_ the code does what it does, rather than describing _what_ it does. The reader can most likely read the code, but not necessarily understand why it was necessary. 14 | 15 | - Don't overdo it in the comments. The code should be clear enough to speak for itself. Stale comments that no longer reflect the intent of the code can hurt code comprehension. 16 | 17 | * Don't repeat yourself. Any time you see that the same piece of logic can be applied in multiple places, factor it out into a function, or variable, and reuse that code. 18 | * Scan your code for expensive operations (large computations, DOM queries, React re-renders). Have you done your possible to limit their impact? If not, it is going to slow your app down. 19 | * Can you think of cases where your current code will break? How are you handling errors? Should the user see them as notifications? Should your app try to auto-correct them for them? 20 | 21 | ## Component API 22 | 23 | - Have you tested your component on the Python side by creating an app in `usage.py` ? 24 | 25 | Do all of your component's props work when set from the back-end? 26 | 27 | Should all of them be settable from the back-end or are some only relevant to user interactions in the front-end? 28 | 29 | - Have you provided some basic documentation about your component? The Dash community uses [react docstrings](https://github.com/plotly/dash-docs/blob/master/tutorial/plugins.py#L45) to provide basic information about dash components. Take a look at this [Checklist component example](https://github.com/plotly/dash-core-components/blob/master/src/components/Checklist.react.js) and others from the dash-core-components repository. 30 | 31 | At a minimum, you should describe what your component does, and describe its props and the features they enable. 32 | 33 | Be careful to use the correct formatting for your docstrings for them to be properly recognized. 34 | 35 | ## Tests 36 | 37 | - The Dash team uses integration tests extensively, and we highly encourage you to write tests for the main functionality of your component. In the `tests` folder of the boilerplate, you can see a sample integration test. By launching it, you will run a sample Dash app in a browser. You can run the test with: 38 | ``` 39 | python -m tests.test_render 40 | ``` 41 | [Browse the Dash component code on GitHub for more examples of testing.](https://github.com/plotly/dash-core-components) 42 | 43 | ## Ready to publish? Final scan 44 | 45 | - Take a last look at the external resources that your component is using. Are all the external resources used [referenced in `MANIFEST.in`](https://github.com/plotly/dash-docs/blob/0b2fd8f892db720a7f3dc1c404b4cff464b5f8d4/tutorial/plugins.py#L55)? 46 | 47 | - [You're ready to publish!](https://github.com/plotly/dash-component-boilerplate/blob/master/%7B%7Bcookiecutter.project_shortname%7D%7D/README.md#create-a-production-build-and-publish) 48 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | from setuptools import setup 4 | 5 | 6 | with open('package.json') as f: 7 | package = json.load(f) 8 | 9 | package_name = package["name"].replace(" ", "_").replace("-", "_") 10 | 11 | setup( 12 | name=package_name, 13 | version=package["version"], 14 | author=package['author'], 15 | packages=[package_name], 16 | include_package_data=True, 17 | license=package['license'], 18 | description=package.get('description', package_name), 19 | install_requires=[], 20 | classifiers = [ 21 | 'Framework :: Dash', 22 | ], 23 | ) 24 | -------------------------------------------------------------------------------- /src/DashDthreeHooks.jl: -------------------------------------------------------------------------------- 1 | 2 | module DashDthreeHooks 3 | using Dash 4 | 5 | const resources_path = realpath(joinpath( @__DIR__, "..", "deps")) 6 | const version = "0.0.1" 7 | 8 | include("bubble.jl") 9 | 10 | function __init__() 11 | DashBase.register_package( 12 | DashBase.ResourcePkg( 13 | "dash_dthree_hooks", 14 | resources_path, 15 | version = version, 16 | [ 17 | DashBase.Resource( 18 | relative_package_path = "dash_dthree_hooks.min.js", 19 | external_url = nothing, 20 | dynamic = nothing, 21 | async = nothing, 22 | type = :js 23 | ), 24 | DashBase.Resource( 25 | relative_package_path = "dash_dthree_hooks.min.js.map", 26 | external_url = nothing, 27 | dynamic = true, 28 | async = nothing, 29 | type = :js 30 | ) 31 | ] 32 | ) 33 | 34 | ) 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /src/bubble.jl: -------------------------------------------------------------------------------- 1 | # AUTO GENERATED FILE - DO NOT EDIT 2 | 3 | export bubble 4 | 5 | """ 6 | bubble(;kwargs...) 7 | 8 | A Bubble component. 9 | Bubble component using d3 and hooks 10 | Keyword arguments: 11 | - `id` (String; optional): The ID used to identify this component in Dash callbacks. 12 | - `width` (Real; optional): Chart width 13 | - `height` (Real; optional): Chart height 14 | - `data` (Array; optional): Data 15 | - `clicked` (Dict; optional): Clicked datum (use in point click callbacks) 16 | """ 17 | function bubble(; kwargs...) 18 | available_props = Symbol[:id, :width, :height, :data, :clicked] 19 | wild_props = Symbol[] 20 | return Component("bubble", "Bubble", "dash_dthree_hooks", available_props, wild_props; kwargs...) 21 | end 22 | 23 | -------------------------------------------------------------------------------- /src/demo/App.js: -------------------------------------------------------------------------------- 1 | /* eslint no-magic-numbers: 0 */ 2 | import React, {Component} from 'react'; 3 | 4 | import { Bubble } from '../lib'; 5 | 6 | class App extends Component { 7 | 8 | constructor() { 9 | super(); 10 | this.state = { 11 | value: '' 12 | }; 13 | this.setProps = this.setProps.bind(this); 14 | } 15 | 16 | setProps(newProps) { 17 | this.setState(newProps); 18 | } 19 | 20 | render() { 21 | return ( 22 |
23 | 27 |
28 | ) 29 | } 30 | } 31 | 32 | export default App; 33 | -------------------------------------------------------------------------------- /src/demo/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | ReactDOM.render(, document.getElementById('root')); 6 | -------------------------------------------------------------------------------- /src/lib/components/Bubble.jsx: -------------------------------------------------------------------------------- 1 | import { useRef, useEffect } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | 4 | import { useResizeObserver } from '../helpers/Hooks.jsx' 5 | 6 | import * as d3 from 'd3'; 7 | 8 | /** 9 | * Bubble component using d3 and hooks 10 | */ 11 | const Bubble = ({id, setProps, data, clicked}) => { 12 | 13 | const svgRef = useRef(null); 14 | const wrapperRef = useRef(null); 15 | const dimensions = useResizeObserver(wrapperRef); 16 | 17 | useEffect(() => { 18 | 19 | if (!data || !svgRef.current || !dimensions) return; 20 | 21 | const svg = d3.select(svgRef.current) 22 | 23 | const pointsG = svg.select("g.pointsLayer") 24 | 25 | // Chart properties 26 | const transitionDuration = 1000 27 | const [minRadius, maxRadius] = [1, 50] 28 | 29 | // Scales 30 | const xScale = d3.scaleLinear() 31 | .domain([0, d3.max(data, d => d.x)]) 32 | .range([maxRadius, dimensions.width - maxRadius]) 33 | 34 | const yScale = d3.scaleLinear() 35 | .domain([0, d3.max(data, d => d.y)]) 36 | .range([dimensions.height - maxRadius, maxRadius]) 37 | 38 | const rScale = d3.scaleLinear() 39 | .domain(d3.extent(data, d => d.r)) 40 | .range([minRadius, maxRadius]) 41 | 42 | // Data join 43 | const points = pointsG.selectAll("circle").data(data, d => d.id) 44 | 45 | points.exit() 46 | .transition() 47 | .duration(transitionDuration) 48 | .attr("r", d => 0) 49 | .remove() 50 | 51 | points 52 | .transition() 53 | .duration(transitionDuration) 54 | .attr("r", d => rScale(d.r)) 55 | .attr("cx", d => xScale(d.x)) 56 | .attr("cy", d => yScale(d.y)) 57 | .attr("fill", d => d.color) 58 | 59 | points.enter() 60 | .append("circle") 61 | .attr("r", d => 0) 62 | .attr("cx", d => xScale(d.x)) 63 | .attr("cy", d => yScale(d.y)) 64 | .attr("fill", d => d.color) 65 | .on('click', (event, d) => { 66 | setProps({"clicked": d}) 67 | }) 68 | .transition() 69 | .duration(transitionDuration) 70 | .attr("r", d => rScale(d.r)) 71 | 72 | }, [data, dimensions]) 73 | 74 | 75 | return( 76 |
77 | 78 | 79 | 80 |
81 | ) 82 | } 83 | 84 | export default Bubble; 85 | 86 | Bubble.propTypes = { 87 | /** 88 | * The ID used to identify this component in Dash callbacks. 89 | */ 90 | id: PropTypes.string, 91 | 92 | /** 93 | * Dash-assigned callback that should be called to report property changes 94 | * to Dash, to make them available for callbacks. 95 | */ 96 | setProps: PropTypes.func, 97 | 98 | /** Chart width */ 99 | width: PropTypes.number, 100 | 101 | /** Chart height */ 102 | height: PropTypes.number, 103 | 104 | /** Data */ 105 | data: PropTypes.array, 106 | 107 | /** Clicked datum (use in point click callbacks) */ 108 | clicked: PropTypes.object, 109 | 110 | }; 111 | -------------------------------------------------------------------------------- /src/lib/helpers/Hooks.jsx: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from "react"; 2 | import ResizeObserver from "resize-observer-polyfill"; 3 | 4 | const useResizeObserver = (ref) => { 5 | const [dimensions, setDimensions] = useState(null); 6 | useEffect(() => { 7 | const observeTarget = ref.current; 8 | const resizeObserver = new ResizeObserver((entries) => { 9 | entries.forEach((entry) => { 10 | setDimensions(entry.contentRect); 11 | }); 12 | }); 13 | resizeObserver.observe(observeTarget); 14 | return () => { 15 | resizeObserver.unobserve(observeTarget); 16 | }; 17 | }, [ref]); 18 | return dimensions; 19 | }; 20 | 21 | export { 22 | useResizeObserver 23 | }; -------------------------------------------------------------------------------- /src/lib/index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/prefer-default-export */ 2 | import Bubble from './components/Bubble.jsx'; 3 | 4 | export { 5 | Bubble 6 | }; 7 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jlfsjunior/dash_dthree_hooks/89cfa556c02a3c5b08b53e6e33c7ccc053c82473/tests/__init__.py -------------------------------------------------------------------------------- /tests/requirements.txt: -------------------------------------------------------------------------------- 1 | # Packages needed to run the tests. 2 | # Switch into a virtual environment 3 | # pip install -r requirements.txt 4 | 5 | dash[dev,testing]>=1.15.0 6 | -------------------------------------------------------------------------------- /tests/test_usage.py: -------------------------------------------------------------------------------- 1 | from dash.testing.application_runners import import_app 2 | 3 | 4 | # Basic test for the component rendering. 5 | # The dash_duo pytest fixture is installed with dash (v1.0+) 6 | def test_render_component(dash_duo): 7 | # Start a dash app contained as the variable `app` in `usage.py` 8 | app = import_app('usage') 9 | dash_duo.start_server(app) 10 | 11 | # Get the generated component input with selenium 12 | # The html input will be a children of the #input dash component 13 | my_component = dash_duo.find_element('#input > input') 14 | 15 | assert 'my-value' == my_component.get_attribute('value') 16 | 17 | # Clear the input 18 | dash_duo.clear_input(my_component) 19 | 20 | # Send keys to the custom input. 21 | my_component.send_keys('Hello dash') 22 | 23 | # Wait for the text to equal, if after the timeout (default 10 seconds) 24 | # the text is not equal it will fail the test. 25 | dash_duo.wait_for_text_to_equal('#output', 'You have entered Hello dash') 26 | -------------------------------------------------------------------------------- /usage.py: -------------------------------------------------------------------------------- 1 | import dash_dthree_hooks 2 | import dash 3 | from dash.dependencies import Input, Output 4 | import dash_html_components as html 5 | import dash_bootstrap_components as dbc 6 | 7 | import random 8 | import json 9 | 10 | app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP]) 11 | 12 | app.layout = html.Div( 13 | [ 14 | dash_dthree_hooks.Bubble( 15 | id='bubble-chart', 16 | ), 17 | html.Div( 18 | [ 19 | dbc.Button(id="update-data", children="Update Data", color="success", className="mr-1"), 20 | html.P(id='clicked-output') 21 | ] 22 | ) 23 | ], 24 | style={ 25 | "padding": "25px 50px" 26 | } 27 | ) 28 | 29 | 30 | @app.callback( 31 | Output('bubble-chart', 'data'), 32 | [Input("update-data", 'n_clicks')] 33 | ) 34 | def change_data(n_clicks): 35 | 36 | colors = ['red', 'green', 'blue', 'orange', 'yellow', 'purple', 'gray'] 37 | 38 | n_points = random.randint(1, 10) 39 | 40 | data = [ 41 | { 42 | 'id': id, 43 | 'x': random.randint(0, 100), 44 | 'y': random.randint(0, 100), 45 | 'r': random.randint(0, 100), 46 | 'color': random.choice(colors) 47 | } for id in range(n_points) ] 48 | 49 | return data 50 | 51 | @app.callback( 52 | Output('clicked-output', 'children'), 53 | [Input("bubble-chart", 'clicked')] 54 | ) 55 | def click_point(datum): 56 | if datum is None: 57 | return "Click on something!" 58 | else: 59 | datum_str = json.dumps(datum) 60 | return datum_str 61 | 62 | if __name__ == '__main__': 63 | app.run_server(debug=True) 64 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const packagejson = require('./package.json'); 3 | 4 | const dashLibraryName = packagejson.name.replace(/-/g, '_'); 5 | 6 | module.exports = (env, argv) => { 7 | 8 | let mode; 9 | 10 | const overrides = module.exports || {}; 11 | 12 | // if user specified mode flag take that value 13 | if (argv && argv.mode) { 14 | mode = argv.mode; 15 | } 16 | 17 | // else if configuration object is already set (module.exports) use that value 18 | else if (overrides.mode) { 19 | mode = overrides.mode; 20 | } 21 | 22 | // else take webpack default (production) 23 | else { 24 | mode = 'production'; 25 | } 26 | 27 | let filename = (overrides.output || {}).filename; 28 | if(!filename) { 29 | const modeSuffix = mode === 'development' ? 'dev' : 'min'; 30 | filename = `${dashLibraryName}.${modeSuffix}.js`; 31 | } 32 | 33 | const entry = overrides.entry || {main: './src/lib/index.js'}; 34 | 35 | const devtool = overrides.devtool || 'source-map'; 36 | 37 | const externals = ('externals' in overrides) ? overrides.externals : ({ 38 | react: 'React', 39 | 'react-dom': 'ReactDOM', 40 | 'plotly.js': 'Plotly', 41 | 'prop-types': 'PropTypes', 42 | }); 43 | 44 | return { 45 | mode, 46 | entry, 47 | output: { 48 | path: path.resolve(__dirname, dashLibraryName), 49 | filename, 50 | library: dashLibraryName, 51 | libraryTarget: 'window', 52 | }, 53 | devtool, 54 | externals, 55 | module: { 56 | rules: [ 57 | { 58 | test: /\.jsx?$/, 59 | exclude: /node_modules/, 60 | use: { 61 | loader: 'babel-loader', 62 | }, 63 | }, 64 | { 65 | test: /\.css$/, 66 | use: [ 67 | { 68 | loader: 'style-loader', 69 | options: { 70 | insertAt: 'top' 71 | } 72 | }, 73 | { 74 | loader: 'css-loader', 75 | }, 76 | ], 77 | }, 78 | ], 79 | }, 80 | } 81 | }; 82 | -------------------------------------------------------------------------------- /webpack.serve.config.js: -------------------------------------------------------------------------------- 1 | const config = require('./webpack.config.js'); 2 | const path = require('path'); 3 | 4 | config.entry = {main: './src/demo/index.js'}; 5 | config.output = { 6 | filename: './output.js', 7 | path: path.resolve(__dirname), 8 | }; 9 | config.mode = 'development'; 10 | config.externals = undefined; // eslint-disable-line 11 | config.devtool = 'inline-source-map'; 12 | module.exports = config; 13 | --------------------------------------------------------------------------------