├── .gitignore ├── README.md ├── docs ├── ast │ └── source │ │ ├── DebugView.js.json │ │ ├── ReactNipple.js.json │ │ └── index.js.json ├── badge.svg ├── class │ └── src │ │ ├── ReactNipple.js~Nipple.html │ │ └── ReactNipple.js~ReactNipple.html ├── coverage.json ├── css │ ├── prettify-tomorrow.css │ └── style.css ├── dump.json ├── file │ └── src │ │ ├── DebugView.js.html │ │ ├── ReactNipple.js.html │ │ └── index.js.html ├── identifiers.html ├── image │ ├── badge.svg │ ├── esdoc-logo-mini-black.png │ ├── esdoc-logo-mini.png │ ├── github.png │ ├── manual-badge.svg │ └── search.png ├── index.html ├── manual-badge.svg ├── manual │ └── index.html ├── package.json ├── script │ ├── inherited-summary.js │ ├── inner-link.js │ ├── manual.js │ ├── patch-for-local.js │ ├── prettify │ │ ├── Apache-License-2.0.txt │ │ └── prettify.js │ ├── pretty-print.js │ ├── search.js │ ├── search_index.js │ └── test-summary.js └── source.html ├── package.json ├── packages ├── demo │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ └── manifest.json │ └── src │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── ReactNippleExample.js │ │ ├── index.css │ │ ├── index.js │ │ ├── logo.svg │ │ └── registerServiceWorker.js └── react-nipple │ ├── .babelrc │ ├── .esdoc.js │ ├── .eslintrc │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── lib │ ├── DebugView.js │ ├── ReactNipple.js │ ├── index.js │ └── styles.css │ ├── package.json │ ├── prettier.config.js │ ├── preview.gif │ ├── src │ ├── DebugView.js │ ├── ReactNipple.js │ ├── index.js │ └── styles.css │ └── yarn.lock ├── workspace.sublime-project └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | *.sublime-workspace 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-nipple 2 | 3 | A react wrapper for the [nipplejs](https://www.npmjs.com/package/nipplejs) on-screen-joystick. 4 | 5 | 6 | 7 | This is the workspace repository for the [react-nipple](https://www.npmjs.com/package/react-nipple) package. 8 | 9 | - Check [/packages/react-nipple](https://github.com/loopmode/react-nipple/tree/master/packages/react-nipple) for the package itself 10 | - Check [/packages/demo](https://github.com/loopmode/react-nipple/tree/master/packages/demo) for a simple demo app built with `create-react-app` 11 | 12 | ### Resources 13 | 14 | - Github repository: [https://github.com/loopmode/react-nipple](https://github.com/loopmode/react-nipple) 15 | - NPM package: [https://www.npmjs.com/package/react-nipple](https://www.npmjs.com/package/react-nipple) 16 | - Docs: [https://loopmode.github.io/react-nipple/](https://loopmode.github.io/react-nipple/) 17 | -------------------------------------------------------------------------------- /docs/ast/source/index.js.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "File", 3 | "start": 0, 4 | "end": 38, 5 | "loc": { 6 | "start": { 7 | "line": 1, 8 | "column": 0 9 | }, 10 | "end": { 11 | "line": 2, 12 | "column": 0 13 | } 14 | }, 15 | "program": { 16 | "type": "Program", 17 | "start": 0, 18 | "end": 38, 19 | "loc": { 20 | "start": { 21 | "line": 1, 22 | "column": 0 23 | }, 24 | "end": { 25 | "line": 2, 26 | "column": 0 27 | } 28 | }, 29 | "sourceType": "module", 30 | "body": [ 31 | { 32 | "type": "ExportNamedDeclaration", 33 | "start": 0, 34 | "end": 36, 35 | "loc": { 36 | "start": { 37 | "line": 1, 38 | "column": 0 39 | }, 40 | "end": { 41 | "line": 1, 42 | "column": 36 43 | } 44 | }, 45 | "specifiers": [ 46 | { 47 | "type": "ExportDefaultSpecifier", 48 | "start": 7, 49 | "end": 14, 50 | "loc": { 51 | "start": { 52 | "line": 1, 53 | "column": 7 54 | }, 55 | "end": { 56 | "line": 1, 57 | "column": 14 58 | } 59 | }, 60 | "exported": { 61 | "type": "Identifier", 62 | "start": 7, 63 | "end": 14, 64 | "loc": { 65 | "start": { 66 | "line": 1, 67 | "column": 7 68 | }, 69 | "end": { 70 | "line": 1, 71 | "column": 14 72 | }, 73 | "identifierName": "default" 74 | }, 75 | "name": "default" 76 | } 77 | } 78 | ], 79 | "source": { 80 | "type": "StringLiteral", 81 | "start": 20, 82 | "end": 35, 83 | "loc": { 84 | "start": { 85 | "line": 1, 86 | "column": 20 87 | }, 88 | "end": { 89 | "line": 1, 90 | "column": 35 91 | } 92 | }, 93 | "extra": { 94 | "rawValue": "./ReactNipple", 95 | "raw": "'./ReactNipple'" 96 | }, 97 | "value": "./ReactNipple" 98 | } 99 | } 100 | ], 101 | "directives": [] 102 | }, 103 | "comments": [], 104 | "tokens": [ 105 | { 106 | "type": { 107 | "label": "export", 108 | "keyword": "export", 109 | "beforeExpr": false, 110 | "startsExpr": false, 111 | "rightAssociative": false, 112 | "isLoop": false, 113 | "isAssign": false, 114 | "prefix": false, 115 | "postfix": false, 116 | "binop": null, 117 | "updateContext": null 118 | }, 119 | "value": "export", 120 | "start": 0, 121 | "end": 6, 122 | "loc": { 123 | "start": { 124 | "line": 1, 125 | "column": 0 126 | }, 127 | "end": { 128 | "line": 1, 129 | "column": 6 130 | } 131 | } 132 | }, 133 | { 134 | "type": { 135 | "label": "default", 136 | "keyword": "default", 137 | "beforeExpr": true, 138 | "startsExpr": false, 139 | "rightAssociative": false, 140 | "isLoop": false, 141 | "isAssign": false, 142 | "prefix": false, 143 | "postfix": false, 144 | "binop": null, 145 | "updateContext": null 146 | }, 147 | "value": "default", 148 | "start": 7, 149 | "end": 14, 150 | "loc": { 151 | "start": { 152 | "line": 1, 153 | "column": 7 154 | }, 155 | "end": { 156 | "line": 1, 157 | "column": 14 158 | } 159 | } 160 | }, 161 | { 162 | "type": { 163 | "label": "name", 164 | "beforeExpr": false, 165 | "startsExpr": true, 166 | "rightAssociative": false, 167 | "isLoop": false, 168 | "isAssign": false, 169 | "prefix": false, 170 | "postfix": false, 171 | "binop": null 172 | }, 173 | "value": "from", 174 | "start": 15, 175 | "end": 19, 176 | "loc": { 177 | "start": { 178 | "line": 1, 179 | "column": 15 180 | }, 181 | "end": { 182 | "line": 1, 183 | "column": 19 184 | } 185 | } 186 | }, 187 | { 188 | "type": { 189 | "label": "string", 190 | "beforeExpr": false, 191 | "startsExpr": true, 192 | "rightAssociative": false, 193 | "isLoop": false, 194 | "isAssign": false, 195 | "prefix": false, 196 | "postfix": false, 197 | "binop": null, 198 | "updateContext": null 199 | }, 200 | "value": "./ReactNipple", 201 | "start": 20, 202 | "end": 35, 203 | "loc": { 204 | "start": { 205 | "line": 1, 206 | "column": 20 207 | }, 208 | "end": { 209 | "line": 1, 210 | "column": 35 211 | } 212 | } 213 | }, 214 | { 215 | "type": { 216 | "label": ";", 217 | "beforeExpr": true, 218 | "startsExpr": false, 219 | "rightAssociative": false, 220 | "isLoop": false, 221 | "isAssign": false, 222 | "prefix": false, 223 | "postfix": false, 224 | "binop": null, 225 | "updateContext": null 226 | }, 227 | "start": 35, 228 | "end": 36, 229 | "loc": { 230 | "start": { 231 | "line": 1, 232 | "column": 35 233 | }, 234 | "end": { 235 | "line": 1, 236 | "column": 36 237 | } 238 | } 239 | }, 240 | { 241 | "type": { 242 | "label": "eof", 243 | "beforeExpr": false, 244 | "startsExpr": false, 245 | "rightAssociative": false, 246 | "isLoop": false, 247 | "isAssign": false, 248 | "prefix": false, 249 | "postfix": false, 250 | "binop": null, 251 | "updateContext": null 252 | }, 253 | "start": 38, 254 | "end": 38, 255 | "loc": { 256 | "start": { 257 | "line": 2, 258 | "column": 0 259 | }, 260 | "end": { 261 | "line": 2, 262 | "column": 0 263 | } 264 | } 265 | } 266 | ] 267 | } -------------------------------------------------------------------------------- /docs/badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | document 13 | document 14 | 100% 15 | 100% 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/class/src/ReactNipple.js~Nipple.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Nipple | my-package API Document 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | Home 18 | Manual 19 | Reference 20 | Source 21 | 22 | 23 | 30 |
31 | 32 | 39 | 40 |
41 |
import Nipple from 'react-nipple/src/ReactNipple.js'
42 | public 43 | class 44 | 45 | 46 | 47 | | source 48 |
49 | 50 |
51 |

Nipple

52 | 53 | 54 | 55 | 56 | 57 |

Extends:

react~Component → Nipple
58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 |

A react wrapper component for nipplejs.

68 |
69 | 70 | 71 |

See:

72 | 73 | 74 | 75 | 76 | 77 | 78 |
79 | 80 |

Static Member Summary

81 | 82 | 83 | 84 | 85 | 92 | 107 | 111 | 112 | 113 |
Static Public Members
86 | public 87 | static 88 | get 89 | 90 | 91 | 93 |
94 |

95 | 96 | 97 | propTypes: {"className": *, "options": *, "static": *, "onStart": *, "onEnd": *, "onMove": *, "onDir": *, "onPlain": *, "onShown": *, "onHidden": *, "onPressure": *, "onCreated": *, "onDestroy": *} 98 |

99 |
100 |
101 | 102 | 103 |

Component propTypes

104 |
105 |
106 |
108 | 109 | 110 |
114 |
115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 |

Static Public Members

123 | 124 |
125 |

126 | public 127 | static 128 | get 129 | 130 | 131 | 132 | propTypes: {"className": *, "options": *, "static": *, "onStart": *, "onEnd": *, "onMove": *, "onDir": *, "onPlain": *, "onShown": *, "onHidden": *, "onPressure": *, "onCreated": *, "onDestroy": *} 133 | 134 | 135 | 136 | source 137 | 138 |

139 | 140 | 141 | 142 | 143 |

Component propTypes

144 |

Any additional (unknown) props will be passed along as attributes of the created DOM element.

145 |
146 | 147 | 148 | 149 |
150 |

Properties:

151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 163 | 164 | 165 | 166 | 167 | 168 | 170 | 171 | 172 | 173 | 174 | 175 | 177 | 178 | 179 | 180 | 181 | 182 | 184 | 185 | 186 | 187 | 188 | 189 | 191 | 192 | 193 | 194 | 195 | 196 | 198 | 199 | 200 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 209 | 210 | 212 | 213 | 214 | 215 | 216 | 217 | 219 | 220 | 221 | 222 | 223 | 224 | 226 | 227 | 228 | 229 | 230 | 231 | 233 | 234 | 235 | 236 | 237 | 238 | 240 | 241 | 242 | 243 | 244 | 245 | 247 | 248 | 249 |
NameTypeAttributeDescription
classNamestring

A css classname for the DOM element

162 |
optionsobject

An object with nipplejs options, see https://github.com/yoannmoinet/nipplejs#options

169 |
staticboolean

A shortcut for setting the options {mode: 'static', position: {top: '50%', left: '50%'}}. Will override values in the options object.

176 |
onCreatedfunction

Callback that is invoked with the created instance

183 |
onDestroyfunction

Callback that is invoked with the instance that is going to be destroyed

190 |
onStartfunction

Callback for the 'start' event handler, see https://github.com/yoannmoinet/nipplejs#start

197 |
onEndfunction

Callback for the 'end' event handler, see https://github.com/yoannmoinet/nipplejs#end

204 |
onMovefunction

Callback for the 'move' event handler, see https://github.com/yoannmoinet/nipplejs#move

211 |
onDirfunction

Callback for the 'dir' event handler, see https://github.com/yoannmoinet/nipplejs#dir

218 |
onPlainfunction

Callback for the 'plain' event handler, see https://github.com/yoannmoinet/nipplejs#plain

225 |
onShownfunction

Callback for the 'shown' event handler, see https://github.com/yoannmoinet/nipplejs#shown

232 |
onHiddenfunction

Callback for the 'hidden' event handler, see https://github.com/yoannmoinet/nipplejs#hidden

239 |
onPressurefunction

Callback for the 'pressure' event handler, see https://github.com/yoannmoinet/nipplejs#pressure

246 |
250 |
251 |
252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 |
270 |
271 | 272 | 273 | 274 | 275 |
276 | 277 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | -------------------------------------------------------------------------------- /docs/class/src/ReactNipple.js~ReactNipple.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ReactNipple | my-package API Document 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | Home 18 | Manual 19 | Reference 20 | Source 21 | 22 | 23 | 30 |
31 | 32 | 39 | 40 |
41 |
import ReactNipple from 'react-nipple/src/ReactNipple.js'
42 | public 43 | class 44 | 45 | 46 | 47 | | source 48 |
49 | 50 |
51 |

ReactNipple

52 | 53 | 54 | 55 | 56 | 57 |

Extends:

react~Component → ReactNipple
58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 |

A react wrapper component for nipplejs.

68 |
69 | 70 | 71 |

See:

72 | 73 | 74 | 75 | 76 | 77 | 78 |
79 | 80 |

Static Member Summary

81 | 82 | 83 | 84 | 85 | 92 | 107 | 111 | 112 | 113 |
Static Public Members
86 | public 87 | static 88 | get 89 | 90 | 91 | 93 |
94 |

95 | 96 | 97 | propTypes: {"className": *, "options": *, "static": *, "onStart": *, "onEnd": *, "onMove": *, "onDir": *, "onPlain": *, "onShown": *, "onHidden": *, "onPressure": *, "onCreated": *, "onDestroy": *} 98 |

99 |
100 |
101 | 102 | 103 |

Component propTypes

104 |
105 |
106 |
108 | 109 | 110 |
114 |
115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 |

Static Public Members

123 | 124 |
125 |

126 | public 127 | static 128 | get 129 | 130 | 131 | 132 | propTypes: {"className": *, "options": *, "static": *, "onStart": *, "onEnd": *, "onMove": *, "onDir": *, "onPlain": *, "onShown": *, "onHidden": *, "onPressure": *, "onCreated": *, "onDestroy": *} 133 | 134 | 135 | 136 | source 137 | 138 |

139 | 140 | 141 | 142 | 143 |

Component propTypes

144 |

Any additional (unknown) props will be passed along as attributes of the created DOM element.

145 |
146 | 147 | 148 | 149 |
150 |

Properties:

151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 163 | 164 | 165 | 166 | 167 | 168 | 170 | 171 | 172 | 173 | 174 | 175 | 177 | 178 | 179 | 180 | 181 | 182 | 184 | 185 | 186 | 187 | 188 | 189 | 191 | 192 | 193 | 194 | 195 | 196 | 198 | 199 | 200 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 209 | 210 | 212 | 213 | 214 | 215 | 216 | 217 | 219 | 220 | 221 | 222 | 223 | 224 | 226 | 227 | 228 | 229 | 230 | 231 | 233 | 234 | 235 | 236 | 237 | 238 | 240 | 241 | 242 | 243 | 244 | 245 | 247 | 248 | 249 |
NameTypeAttributeDescription
classNamestring

A css classname for the DOM element

162 |
optionsobject

An object with nipplejs options, see https://github.com/yoannmoinet/nipplejs#options

169 |
staticboolean

A shortcut for setting the options {mode: 'static', position: {top: '50%', left: '50%'}}. Will override values in the options object.

176 |
onCreatedfunction

Callback that is invoked with the created instance

183 |
onDestroyfunction

Callback that is invoked with the instance that is going to be destroyed

190 |
onStartfunction

Callback for the 'start' event handler, see https://github.com/yoannmoinet/nipplejs#start

197 |
onEndfunction

Callback for the 'end' event handler, see https://github.com/yoannmoinet/nipplejs#end

204 |
onMovefunction

Callback for the 'move' event handler, see https://github.com/yoannmoinet/nipplejs#move

211 |
onDirfunction

Callback for the 'dir' event handler, see https://github.com/yoannmoinet/nipplejs#dir

218 |
onPlainfunction

Callback for the 'plain' event handler, see https://github.com/yoannmoinet/nipplejs#plain

225 |
onShownfunction

Callback for the 'shown' event handler, see https://github.com/yoannmoinet/nipplejs#shown

232 |
onHiddenfunction

Callback for the 'hidden' event handler, see https://github.com/yoannmoinet/nipplejs#hidden

239 |
onPressurefunction

Callback for the 'pressure' event handler, see https://github.com/yoannmoinet/nipplejs#pressure

246 |
250 |
251 |
252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 |
270 |
271 | 272 | 273 | 274 | 275 |
276 | 277 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | -------------------------------------------------------------------------------- /docs/coverage.json: -------------------------------------------------------------------------------- 1 | { 2 | "coverage": "100%", 3 | "expectCount": 2, 4 | "actualCount": 2, 5 | "files": { 6 | "src/ReactNipple.js": { 7 | "expectCount": 2, 8 | "actualCount": 2, 9 | "undocumentLines": [] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /docs/css/prettify-tomorrow.css: -------------------------------------------------------------------------------- 1 | /* Tomorrow Theme */ 2 | /* Original theme - https://github.com/chriskempson/tomorrow-theme */ 3 | /* Pretty printing styles. Used with prettify.js. */ 4 | /* SPAN elements with the classes below are added by prettyprint. */ 5 | /* plain text */ 6 | .pln { 7 | color: #4d4d4c; } 8 | 9 | @media screen { 10 | /* string content */ 11 | .str { 12 | color: #718c00; } 13 | 14 | /* a keyword */ 15 | .kwd { 16 | color: #8959a8; } 17 | 18 | /* a comment */ 19 | .com { 20 | color: #8e908c; } 21 | 22 | /* a type name */ 23 | .typ { 24 | color: #4271ae; } 25 | 26 | /* a literal value */ 27 | .lit { 28 | color: #f5871f; } 29 | 30 | /* punctuation */ 31 | .pun { 32 | color: #4d4d4c; } 33 | 34 | /* lisp open bracket */ 35 | .opn { 36 | color: #4d4d4c; } 37 | 38 | /* lisp close bracket */ 39 | .clo { 40 | color: #4d4d4c; } 41 | 42 | /* a markup tag name */ 43 | .tag { 44 | color: #c82829; } 45 | 46 | /* a markup attribute name */ 47 | .atn { 48 | color: #f5871f; } 49 | 50 | /* a markup attribute value */ 51 | .atv { 52 | color: #3e999f; } 53 | 54 | /* a declaration */ 55 | .dec { 56 | color: #f5871f; } 57 | 58 | /* a variable name */ 59 | .var { 60 | color: #c82829; } 61 | 62 | /* a function name */ 63 | .fun { 64 | color: #4271ae; } } 65 | /* Use higher contrast and text-weight for printable form. */ 66 | @media print, projection { 67 | .str { 68 | color: #060; } 69 | 70 | .kwd { 71 | color: #006; 72 | font-weight: bold; } 73 | 74 | .com { 75 | color: #600; 76 | font-style: italic; } 77 | 78 | .typ { 79 | color: #404; 80 | font-weight: bold; } 81 | 82 | .lit { 83 | color: #044; } 84 | 85 | .pun, .opn, .clo { 86 | color: #440; } 87 | 88 | .tag { 89 | color: #006; 90 | font-weight: bold; } 91 | 92 | .atn { 93 | color: #404; } 94 | 95 | .atv { 96 | color: #060; } } 97 | /* Style */ 98 | /* 99 | pre.prettyprint { 100 | background: white; 101 | font-family: Consolas, Monaco, 'Andale Mono', monospace; 102 | font-size: 12px; 103 | line-height: 1.5; 104 | border: 1px solid #ccc; 105 | padding: 10px; } 106 | */ 107 | 108 | /* Specify class=linenums on a pre to get line numbering */ 109 | ol.linenums { 110 | margin-top: 0; 111 | margin-bottom: 0; } 112 | 113 | /* IE indents via margin-left */ 114 | li.L0, 115 | li.L1, 116 | li.L2, 117 | li.L3, 118 | li.L4, 119 | li.L5, 120 | li.L6, 121 | li.L7, 122 | li.L8, 123 | li.L9 { 124 | /* */ } 125 | 126 | /* Alternate shading for lines */ 127 | li.L1, 128 | li.L3, 129 | li.L5, 130 | li.L7, 131 | li.L9 { 132 | /* */ } 133 | -------------------------------------------------------------------------------- /docs/css/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Roboto:400,300,700); 2 | @import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400italic,600,700); 3 | 4 | * { 5 | margin: 0; 6 | padding: 0; 7 | text-decoration: none; 8 | } 9 | 10 | html 11 | { 12 | font-family: 'Source Sans Pro', 'Roboto', sans-serif; 13 | overflow: auto; 14 | /*font-size: 14px;*/ 15 | /*color: #4d4e53;*/ 16 | /*color: rgba(0, 0, 0, .68);*/ 17 | color: #555; 18 | background-color: #fff; 19 | } 20 | 21 | a { 22 | /*color: #0095dd;*/ 23 | /*color:rgb(37, 138, 175);*/ 24 | color: #039BE5; 25 | } 26 | 27 | code a:hover { 28 | text-decoration: underline; 29 | } 30 | 31 | ul, ol { 32 | padding-left: 20px; 33 | } 34 | 35 | ul li { 36 | list-style: disc; 37 | margin: 4px 0; 38 | } 39 | 40 | ol li { 41 | margin: 4px 0; 42 | } 43 | 44 | h1 { 45 | margin-bottom: 10px; 46 | font-size: 34px; 47 | font-weight: 300; 48 | border-bottom: solid 1px #ddd; 49 | } 50 | 51 | h2 { 52 | margin-top: 24px; 53 | margin-bottom: 10px; 54 | font-size: 20px; 55 | border-bottom: solid 1px #ddd; 56 | font-weight: 300; 57 | } 58 | 59 | h3 { 60 | position: relative; 61 | font-size: 16px; 62 | margin-bottom: 12px; 63 | background-color: #E2E2E2; 64 | padding: 4px; 65 | font-weight: 300; 66 | } 67 | 68 | del { 69 | text-decoration: line-through; 70 | } 71 | 72 | p { 73 | margin-bottom: 15px; 74 | line-height: 1.5; 75 | } 76 | 77 | pre > code { 78 | display: block; 79 | } 80 | 81 | pre.prettyprint, pre > code { 82 | padding: 4px; 83 | margin: 1em 0; 84 | background-color: #f5f5f5; 85 | border-radius: 3px; 86 | } 87 | 88 | pre.prettyprint > code { 89 | margin: 0; 90 | } 91 | 92 | p > code, 93 | li > code { 94 | padding: 0.2em 0.5em; 95 | margin: 0; 96 | font-size: 85%; 97 | background-color: rgba(0,0,0,0.04); 98 | border-radius: 3px; 99 | } 100 | 101 | .import-path pre.prettyprint, 102 | .import-path pre.prettyprint code { 103 | margin: 0; 104 | padding: 0; 105 | border: none; 106 | background: white; 107 | } 108 | 109 | .layout-container { 110 | /*display: flex;*/ 111 | /*flex-direction: row;*/ 112 | /*justify-content: flex-start;*/ 113 | /*align-items: stretch;*/ 114 | } 115 | 116 | .layout-container > header { 117 | height: 40px; 118 | line-height: 40px; 119 | font-size: 16px; 120 | padding: 0 10px; 121 | margin: 0; 122 | position: fixed; 123 | width: 100%; 124 | z-index: 1; 125 | background-color: #fafafa; 126 | top: 0; 127 | border-bottom: solid 1px #ddd; 128 | } 129 | .layout-container > header > a{ 130 | margin: 0 5px; 131 | color: #444; 132 | } 133 | 134 | .layout-container > header > a.repo-url-github { 135 | font-size: 0; 136 | display: inline-block; 137 | width: 20px; 138 | height: 38px; 139 | background: url("../image/github.png") no-repeat center; 140 | background-size: 20px; 141 | vertical-align: top; 142 | } 143 | 144 | .navigation { 145 | position: fixed; 146 | top: 0; 147 | left: 0; 148 | box-sizing: border-box; 149 | width: 250px; 150 | height: 100%; 151 | padding-top: 40px; 152 | padding-left: 15px; 153 | padding-bottom: 2em; 154 | margin-top:1em; 155 | overflow-x: scroll; 156 | box-shadow: rgba(255, 255, 255, 1) -1px 0 0 inset; 157 | border-right: 1px solid #ddd; 158 | } 159 | 160 | .navigation ul { 161 | padding: 0; 162 | } 163 | 164 | .navigation li { 165 | list-style: none; 166 | margin: 4px 0; 167 | white-space: nowrap; 168 | } 169 | 170 | .navigation li a { 171 | color: #666; 172 | } 173 | 174 | .navigation .nav-dir-path { 175 | margin-top: 0.7em; 176 | margin-bottom: 0.25em; 177 | font-size: 0.8em; 178 | color: #aaa; 179 | } 180 | 181 | .kind-class, 182 | .kind-interface, 183 | .kind-function, 184 | .kind-typedef, 185 | .kind-variable, 186 | .kind-external { 187 | margin-left: 0.75em; 188 | width: 1.2em; 189 | height: 1.2em; 190 | display: inline-block; 191 | text-align: center; 192 | border-radius: 0.2em; 193 | margin-right: 0.2em; 194 | font-weight: bold; 195 | } 196 | 197 | .kind-class { 198 | color: #009800; 199 | background-color: #bfe5bf; 200 | } 201 | 202 | .kind-interface { 203 | color: #fbca04; 204 | background-color: #fef2c0; 205 | } 206 | 207 | .kind-function { 208 | color: #6b0090; 209 | background-color: #d6bdde; 210 | } 211 | 212 | .kind-variable { 213 | color: #eb6420; 214 | background-color: #fad8c7; 215 | } 216 | 217 | .kind-typedef { 218 | color: #db001e; 219 | background-color: #edbec3; 220 | } 221 | 222 | .kind-external { 223 | color: #0738c3; 224 | background-color: #bbcbea; 225 | } 226 | 227 | h1 .version, 228 | h1 .url a { 229 | font-size: 14px; 230 | color: #aaa; 231 | } 232 | 233 | .content { 234 | margin-top: 40px; 235 | margin-left: 250px; 236 | padding: 10px 50px 10px 20px; 237 | } 238 | 239 | .header-notice { 240 | font-size: 14px; 241 | color: #aaa; 242 | margin: 0; 243 | } 244 | 245 | .expression-extends .prettyprint { 246 | margin-left: 10px; 247 | background: white; 248 | } 249 | 250 | .extends-chain { 251 | border-bottom: 1px solid#ddd; 252 | padding-bottom: 10px; 253 | margin-bottom: 10px; 254 | } 255 | 256 | .extends-chain span:nth-of-type(1) { 257 | padding-left: 10px; 258 | } 259 | 260 | .extends-chain > div { 261 | margin: 5px 0; 262 | } 263 | 264 | .description table { 265 | font-size: 14px; 266 | border-spacing: 0; 267 | border: 0; 268 | border-collapse: collapse; 269 | } 270 | 271 | .description thead { 272 | background: #999; 273 | color: white; 274 | } 275 | 276 | .description table td, 277 | .description table th { 278 | border: solid 1px #ddd; 279 | padding: 4px; 280 | font-weight: normal; 281 | } 282 | 283 | .flat-list ul { 284 | padding-left: 0; 285 | } 286 | 287 | .flat-list li { 288 | display: inline; 289 | list-style: none; 290 | } 291 | 292 | table.summary { 293 | width: 100%; 294 | margin: 10px 0; 295 | border-spacing: 0; 296 | border: 0; 297 | border-collapse: collapse; 298 | } 299 | 300 | table.summary thead { 301 | background: #999; 302 | color: white; 303 | } 304 | 305 | table.summary td { 306 | border: solid 1px #ddd; 307 | padding: 4px 10px; 308 | } 309 | 310 | table.summary tbody td:nth-child(1) { 311 | text-align: right; 312 | white-space: nowrap; 313 | min-width: 64px; 314 | vertical-align: top; 315 | } 316 | 317 | table.summary tbody td:nth-child(2) { 318 | width: 100%; 319 | border-right: none; 320 | } 321 | 322 | table.summary tbody td:nth-child(3) { 323 | white-space: nowrap; 324 | border-left: none; 325 | vertical-align: top; 326 | } 327 | 328 | table.summary td > div:nth-of-type(2) { 329 | padding-top: 4px; 330 | padding-left: 15px; 331 | } 332 | 333 | table.summary td p { 334 | margin-bottom: 0; 335 | } 336 | 337 | .inherited-summary thead td { 338 | padding-left: 2px; 339 | } 340 | 341 | .inherited-summary thead a { 342 | color: white; 343 | } 344 | 345 | .inherited-summary .summary tbody { 346 | display: none; 347 | } 348 | 349 | .inherited-summary .summary .toggle { 350 | padding: 0 4px; 351 | font-size: 12px; 352 | cursor: pointer; 353 | } 354 | .inherited-summary .summary .toggle.closed:before { 355 | content: "▶"; 356 | } 357 | .inherited-summary .summary .toggle.opened:before { 358 | content: "▼"; 359 | } 360 | 361 | .member, .method { 362 | margin-bottom: 24px; 363 | } 364 | 365 | table.params { 366 | width: 100%; 367 | margin: 10px 0; 368 | border-spacing: 0; 369 | border: 0; 370 | border-collapse: collapse; 371 | } 372 | 373 | table.params thead { 374 | background: #eee; 375 | color: #aaa; 376 | } 377 | 378 | table.params td { 379 | padding: 4px; 380 | border: solid 1px #ddd; 381 | } 382 | 383 | table.params td p { 384 | margin: 0; 385 | } 386 | 387 | .content .detail > * { 388 | margin: 15px 0; 389 | } 390 | 391 | .content .detail > h3 { 392 | color: black; 393 | } 394 | 395 | .content .detail > div { 396 | margin-left: 10px; 397 | } 398 | 399 | .content .detail > .import-path { 400 | margin-top: -8px; 401 | } 402 | 403 | .content .detail + .detail { 404 | margin-top: 30px; 405 | } 406 | 407 | .content .detail .throw td:first-child { 408 | padding-right: 10px; 409 | } 410 | 411 | .content .detail h4 + :not(pre) { 412 | padding-left: 0; 413 | margin-left: 10px; 414 | } 415 | 416 | .content .detail h4 + ul li { 417 | list-style: none; 418 | } 419 | 420 | .return-param * { 421 | display: inline; 422 | } 423 | 424 | .argument-params { 425 | margin-bottom: 20px; 426 | } 427 | 428 | .return-type { 429 | padding-right: 10px; 430 | font-weight: normal; 431 | } 432 | 433 | .return-desc { 434 | margin-left: 10px; 435 | margin-top: 4px; 436 | } 437 | 438 | .return-desc p { 439 | margin: 0; 440 | } 441 | 442 | .deprecated, .experimental, .instance-docs { 443 | border-left: solid 5px orange; 444 | padding-left: 4px; 445 | margin: 4px 0; 446 | } 447 | 448 | tr.listen p, 449 | tr.throw p, 450 | tr.emit p{ 451 | margin-bottom: 10px; 452 | } 453 | 454 | .version, .since { 455 | color: #aaa; 456 | } 457 | 458 | h3 .right-info { 459 | position: absolute; 460 | right: 4px; 461 | font-size: 14px; 462 | } 463 | 464 | .version + .since:before { 465 | content: '| '; 466 | } 467 | 468 | .see { 469 | margin-top: 10px; 470 | } 471 | 472 | .see h4 { 473 | margin: 4px 0; 474 | } 475 | 476 | .content .detail h4 + .example-doc { 477 | margin: 6px 0; 478 | } 479 | 480 | .example-caption { 481 | position: relative; 482 | bottom: -1px; 483 | display: inline-block; 484 | padding: 4px; 485 | font-style: italic; 486 | background-color: #f5f5f5; 487 | font-weight: bold; 488 | border-radius: 3px; 489 | border-bottom-left-radius: 0; 490 | border-bottom-right-radius: 0; 491 | } 492 | 493 | .example-caption + pre.source-code { 494 | margin-top: 0; 495 | border-top-left-radius: 0; 496 | } 497 | 498 | footer, .file-footer { 499 | text-align: right; 500 | font-style: italic; 501 | font-weight: 100; 502 | font-size: 13px; 503 | margin-right: 50px; 504 | margin-left: 270px; 505 | border-top: 1px solid #ddd; 506 | padding-top: 30px; 507 | margin-top: 20px; 508 | padding-bottom: 10px; 509 | } 510 | 511 | footer img { 512 | width: 24px; 513 | vertical-align: middle; 514 | padding-left: 4px; 515 | position: relative; 516 | top: -3px; 517 | opacity: 0.6; 518 | } 519 | 520 | pre.source-code { 521 | background: #f5f5f5; 522 | padding: 4px; 523 | } 524 | 525 | pre.raw-source-code > code { 526 | padding: 0; 527 | margin: 0; 528 | } 529 | 530 | pre.source-code.line-number { 531 | padding: 0; 532 | } 533 | 534 | pre.source-code ol { 535 | background: #eee; 536 | padding-left: 40px; 537 | } 538 | 539 | pre.source-code li { 540 | background: white; 541 | padding-left: 4px; 542 | list-style: decimal; 543 | margin: 0; 544 | } 545 | 546 | pre.source-code.line-number li.active { 547 | background: rgb(255, 255, 150); 548 | } 549 | 550 | pre.source-code.line-number li.error-line { 551 | background: #ffb8bf; 552 | } 553 | 554 | table.files-summary { 555 | width: 100%; 556 | margin: 10px 0; 557 | border-spacing: 0; 558 | border: 0; 559 | border-collapse: collapse; 560 | text-align: right; 561 | } 562 | 563 | table.files-summary tbody tr:hover { 564 | background: #eee; 565 | } 566 | 567 | table.files-summary td:first-child, 568 | table.files-summary td:nth-of-type(2) { 569 | text-align: left; 570 | } 571 | 572 | table.files-summary[data-use-coverage="false"] td.coverage { 573 | display: none; 574 | } 575 | 576 | table.files-summary thead { 577 | background: #999; 578 | color: white; 579 | } 580 | 581 | table.files-summary td { 582 | border: solid 1px #ddd; 583 | padding: 4px 10px; 584 | vertical-align: top; 585 | } 586 | 587 | table.files-summary td.identifiers > span { 588 | display: block; 589 | margin-top: 4px; 590 | } 591 | table.files-summary td.identifiers > span:first-child { 592 | margin-top: 0; 593 | } 594 | 595 | table.files-summary .coverage-count { 596 | font-size: 12px; 597 | color: #aaa; 598 | display: inline-block; 599 | min-width: 40px; 600 | } 601 | 602 | .total-coverage-count { 603 | position: relative; 604 | bottom: 2px; 605 | font-size: 12px; 606 | color: #666; 607 | font-weight: 500; 608 | padding-left: 5px; 609 | } 610 | 611 | table.test-summary thead { 612 | background: #999; 613 | color: white; 614 | } 615 | 616 | table.test-summary thead .test-description { 617 | width: 50%; 618 | } 619 | 620 | table.test-summary { 621 | width: 100%; 622 | margin: 10px 0; 623 | border-spacing: 0; 624 | border: 0; 625 | border-collapse: collapse; 626 | } 627 | 628 | table.test-summary thead .test-count { 629 | width: 3em; 630 | } 631 | 632 | table.test-summary tbody tr:hover { 633 | background-color: #eee; 634 | } 635 | 636 | table.test-summary td { 637 | border: solid 1px #ddd; 638 | padding: 4px 10px; 639 | vertical-align: top; 640 | } 641 | 642 | table.test-summary td p { 643 | margin: 0; 644 | } 645 | 646 | table.test-summary tr.test-describe .toggle { 647 | display: inline-block; 648 | float: left; 649 | margin-right: 4px; 650 | cursor: pointer; 651 | font-size: 0.8em; 652 | padding-top: 0.25em; 653 | } 654 | 655 | table.test-summary tr.test-describe .toggle.opened:before { 656 | content: '▼'; 657 | } 658 | 659 | table.test-summary tr.test-describe .toggle.closed:before { 660 | content: '▶'; 661 | } 662 | 663 | table.test-summary .test-target > span { 664 | display: block; 665 | margin-top: 4px; 666 | } 667 | table.test-summary .test-target > span:first-child { 668 | margin-top: 0; 669 | } 670 | 671 | .inner-link-active { 672 | background: rgb(255, 255, 150); 673 | } 674 | 675 | /* search box */ 676 | .search-box { 677 | position: absolute; 678 | top: 10px; 679 | right: 50px; 680 | padding-right: 8px; 681 | padding-bottom: 10px; 682 | line-height: normal; 683 | font-size: 12px; 684 | } 685 | 686 | .search-box img { 687 | width: 20px; 688 | vertical-align: top; 689 | } 690 | 691 | .search-input { 692 | display: inline; 693 | visibility: hidden; 694 | width: 0; 695 | padding: 2px; 696 | height: 1.5em; 697 | outline: none; 698 | background: transparent; 699 | border: 1px #0af; 700 | border-style: none none solid none; 701 | vertical-align: bottom; 702 | } 703 | 704 | .search-input-edge { 705 | display: none; 706 | width: 1px; 707 | height: 5px; 708 | background-color: #0af; 709 | vertical-align: bottom; 710 | } 711 | 712 | .search-result { 713 | position: absolute; 714 | display: none; 715 | height: 600px; 716 | width: 100%; 717 | padding: 0; 718 | margin-top: 5px; 719 | margin-left: 24px; 720 | background: white; 721 | box-shadow: 1px 1px 4px rgb(0,0,0); 722 | white-space: nowrap; 723 | overflow-y: scroll; 724 | } 725 | 726 | .search-result-import-path { 727 | color: #aaa; 728 | font-size: 12px; 729 | } 730 | 731 | .search-result li { 732 | list-style: none; 733 | padding: 2px 4px; 734 | } 735 | 736 | .search-result li a { 737 | display: block; 738 | } 739 | 740 | .search-result li.selected { 741 | background: #ddd; 742 | } 743 | 744 | .search-result li.search-separator { 745 | background: rgb(37, 138, 175); 746 | color: white; 747 | } 748 | 749 | .search-box.active .search-input { 750 | visibility: visible; 751 | transition: width 0.2s ease-out; 752 | width: 300px; 753 | } 754 | 755 | .search-box.active .search-input-edge { 756 | display: inline-block; 757 | } 758 | 759 | .github-markdown .manual-toc { 760 | padding-left: 0; 761 | } 762 | 763 | /** manual */ 764 | 765 | .manual-index .manual-cards { 766 | display: flex; 767 | flex-wrap: wrap; 768 | } 769 | 770 | .manual-index .manual-card-wrap { 771 | width: 280px; 772 | padding: 10px 20px 10px 0; 773 | box-sizing: border-box; 774 | } 775 | 776 | .manual-index .manual-card-wrap > h1 { 777 | margin: 0; 778 | font-size: 1em; 779 | font-weight: 600; 780 | padding: 0.2em 0 0.2em 0.5em; 781 | border-radius: 0.1em 0.1em 0 0; 782 | border: none; 783 | } 784 | 785 | .manual-index .manual-card-wrap > h1 span { 786 | color: #555; 787 | } 788 | 789 | .manual-index .manual-card { 790 | height: 200px; 791 | overflow: hidden; 792 | border: solid 1px rgba(230, 230, 230, 0.84); 793 | border-radius: 0 0 0.1em 0.1em; 794 | padding: 8px; 795 | position: relative; 796 | border-top: none; 797 | } 798 | 799 | .manual-index .manual-card > div { 800 | transform: scale(0.4); 801 | transform-origin: 0 0; 802 | width: 250%; 803 | } 804 | 805 | .manual-index .manual-card > a { 806 | position: absolute; 807 | top: 0; 808 | left: 0; 809 | width: 100%; 810 | height: 100%; 811 | background: rgba(210, 210, 210, 0.1); 812 | } 813 | 814 | .manual-index .manual-card > a:hover { 815 | background: none; 816 | } 817 | 818 | .manual-index .manual-badge { 819 | margin: 0; 820 | } 821 | 822 | .manual-index .manual-user-index { 823 | margin-bottom: 1em; 824 | border-bottom: solid 1px #ddd; 825 | } 826 | 827 | .manual-root .navigation { 828 | padding-left: 4px; 829 | margin-top: 4px; 830 | } 831 | 832 | .navigation .manual-toc { 833 | margin-top: -0.25em; 834 | } 835 | 836 | .navigation .manual-toc-root > div { 837 | padding-top: 1px; 838 | padding-left: 0.25em; 839 | padding-right: 0.75em; 840 | } 841 | 842 | .github-markdown .manual-toc-title a { 843 | color: inherit; 844 | } 845 | 846 | .manual-breadcrumb-list { 847 | font-size: 0.8em; 848 | margin-bottom: 1em; 849 | } 850 | 851 | .manual-toc-title a:hover { 852 | color: #039BE5; 853 | } 854 | 855 | .manual-toc li { 856 | margin: 0.75em 0; 857 | list-style-type: none; 858 | } 859 | 860 | .navigation .manual-toc [class^="indent-h"] a { 861 | color: #666; 862 | } 863 | 864 | .navigation .manual-toc .indent-h1 a { 865 | color: #555; 866 | font-weight: 600; 867 | display: block; 868 | } 869 | 870 | .manual-toc .indent-h1 { 871 | display: block; 872 | margin: 1em 0 0 0.25em; 873 | padding: 0.2em 0 0.2em 0.5em; 874 | border-radius: 0.1em; 875 | } 876 | .manual-toc .indent-h2 { 877 | display: none; 878 | margin-left: 1.5em; 879 | } 880 | .manual-toc .indent-h3 { 881 | display: none; 882 | margin-left: 2.5em; 883 | } 884 | .manual-toc .indent-h4 { 885 | display: none; 886 | margin-left: 3.5em; 887 | } 888 | .manual-toc .indent-h5 { 889 | display: none; 890 | margin-left: 4.5em; 891 | } 892 | 893 | .manual-color { 894 | position: relative; 895 | } 896 | 897 | .manual-color:after { 898 | content: attr(data-section-count); 899 | font-size: 0.5em; 900 | opacity: 0.5; 901 | position: absolute; 902 | right: 0.5em; 903 | top: 0.5em; 904 | } 905 | 906 | .manual-color-overview, 907 | .manual-color-design { 908 | color: #db001e; 909 | background-color: #edbec3; 910 | } 911 | 912 | .manual-color-installation, 913 | .manual-color-tutorial, 914 | .manual-color-usage, 915 | .manual-color-configuration, 916 | .manual-color-advanced { 917 | color: #009800; 918 | background-color: #bfe5bf; 919 | } 920 | 921 | .manual-color-example { 922 | color: #eb6420; 923 | background-color: #fad8c7; 924 | } 925 | 926 | .manual-color-reference { 927 | color: #6b0090; 928 | background-color: #d6bdde; 929 | } 930 | 931 | .manual-color-faq, 932 | .manual-color-changelog { 933 | color: #0738c3; 934 | background-color: #bbcbea; 935 | } 936 | 937 | .manual-nav li { 938 | margin: 0.75em 0; 939 | } 940 | 941 | /* github markdown */ 942 | .github-markdown { 943 | font-size: 16px; 944 | } 945 | 946 | .github-markdown h1, 947 | .github-markdown h2, 948 | .github-markdown h3, 949 | .github-markdown h4, 950 | .github-markdown h5 { 951 | margin-top: 1em; 952 | margin-bottom: 16px; 953 | font-weight: bold; 954 | padding: 0; 955 | } 956 | 957 | .github-markdown h1:nth-of-type(1) { 958 | margin-top: 0; 959 | } 960 | 961 | .github-markdown h1 { 962 | font-size: 2em; 963 | padding-bottom: 0.3em; 964 | } 965 | 966 | .github-markdown h2 { 967 | font-size: 1.75em; 968 | padding-bottom: 0.3em; 969 | } 970 | 971 | .github-markdown h3 { 972 | font-size: 1.5em; 973 | background-color: transparent; 974 | } 975 | 976 | .github-markdown h4 { 977 | font-size: 1.25em; 978 | } 979 | 980 | .github-markdown h5 { 981 | font-size: 1em; 982 | } 983 | 984 | .github-markdown ul, .github-markdown ol { 985 | padding-left: 2em; 986 | } 987 | 988 | .github-markdown pre > code { 989 | font-size: 0.85em; 990 | } 991 | 992 | .github-markdown table { 993 | margin-bottom: 1em; 994 | border-collapse: collapse; 995 | border-spacing: 0; 996 | } 997 | 998 | .github-markdown table tr { 999 | background-color: #fff; 1000 | border-top: 1px solid #ccc; 1001 | } 1002 | 1003 | .github-markdown table th, 1004 | .github-markdown table td { 1005 | padding: 6px 13px; 1006 | border: 1px solid #ddd; 1007 | } 1008 | 1009 | .github-markdown table tr:nth-child(2n) { 1010 | background-color: #f8f8f8; 1011 | } 1012 | 1013 | .github-markdown hr { 1014 | border-right: 0; 1015 | border-bottom: 1px solid #e5e5e5; 1016 | border-left: 0; 1017 | border-top: 0; 1018 | } 1019 | 1020 | /** badge(.svg) does not have border */ 1021 | .github-markdown img:not([src*=".svg"]) { 1022 | max-width: 100%; 1023 | box-shadow: 1px 1px 1px rgba(0,0,0,0.5); 1024 | } 1025 | -------------------------------------------------------------------------------- /docs/file/src/DebugView.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | src/DebugView.js | my-package API Document 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | Home 18 | Manual 19 | Reference 20 | Source 21 | 22 | 23 | 30 |
31 | 32 | 39 | 40 |

src/DebugView.js

41 |
import React, { Component } from 'react';
 42 | import PropTypes from 'prop-types';
 43 | 
 44 | export default class DebugView extends Component {
 45 |     static propTypes = {
 46 |         data: PropTypes.shape({
 47 |             position: PropTypes.shape({
 48 |                 x: PropTypes.number,
 49 |                 y: PropTypes.number
 50 |             }),
 51 |             angle: PropTypes.shape({
 52 |                 radian: PropTypes.number,
 53 |                 degree: PropTypes.number
 54 |             }),
 55 |             direction: PropTypes.shape({
 56 |                 x: PropTypes.number,
 57 |                 y: PropTypes.number,
 58 |                 angle: PropTypes.number
 59 |             }),
 60 |             force: PropTypes.number,
 61 |             pressure: PropTypes.number,
 62 |             distance: PropTypes.number
 63 |         })
 64 |     };
 65 |     render() {
 66 |         const { position = {}, force, pressure, distance, angle = {}, direction = {} } = this.props.data || {};
 67 | 
 68 |         return (
 69 |             <div className="debug">
 70 |                 <ul>
 71 |                     <li className="position">
 72 |                         position :
 73 |                         <ul>
 74 |                             <li className="x">
 75 |                                 x :
 76 |                                 <span className="data" children={position.x} />
 77 |                             </li>
 78 |                             <li className="y">
 79 |                                 y :
 80 |                                 <span className="data" children={position.y} />
 81 |                             </li>
 82 |                         </ul>
 83 |                     </li>
 84 |                     <li className="force">
 85 |                         force : <span className="data" children={force} />
 86 |                     </li>
 87 |                     <li className="pressure">
 88 |                         pressure : <span className="data" children={pressure} />
 89 |                     </li>
 90 |                     <li className="distance">
 91 |                         distance : <span className="data" children={distance} />
 92 |                     </li>
 93 |                     <li className="angle">
 94 |                         angle :
 95 |                         <ul>
 96 |                             <li className="radian">
 97 |                                 radian :
 98 |                                 <span className="data" children={angle.radian} />
 99 |                             </li>
100 |                             <li className="degree">
101 |                                 degree :
102 |                                 <span className="data" children={angle.degree} />
103 |                             </li>
104 |                         </ul>
105 |                     </li>
106 |                     <li className="direction">
107 |                         direction :
108 |                         <ul>
109 |                             <li className="x">
110 |                                 x :
111 |                                 <span className="data" children={direction.x} />
112 |                             </li>
113 |                             <li className="y">
114 |                                 y :
115 |                                 <span className="data" children={direction.y} />
116 |                             </li>
117 |                             <li className="angle">
118 |                                 angle :
119 |                                 <span className="data" children={direction.angle} />
120 |                             </li>
121 |                         </ul>
122 |                     </li>
123 |                 </ul>
124 |                 <div className="dump" />
125 |             </div>
126 |         );
127 |     }
128 | }
129 | 
130 | 131 |
132 | 133 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /docs/file/src/ReactNipple.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | src/ReactNipple.js | my-package API Document 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | Home 18 | Manual 19 | Reference 20 | Source 21 | 22 | 23 | 30 |
31 | 32 | 39 | 40 |

src/ReactNipple.js

41 |
import nipplejs from 'nipplejs';
 42 | import autobind from 'autobind-decorator';
 43 | import isEqual from 'lodash.isequal';
 44 | import PropTypes from 'prop-types';
 45 | import React, { Component } from 'react';
 46 | 
 47 | import cx from 'classnames';
 48 | 
 49 | /**
 50 |  * A react wrapper component for `nipplejs`.
 51 |  * @see https://www.npmjs.com/package/nipplejs
 52 |  * @author Jovica Aleksic <jovica.aleksic@loopmode.de>
 53 |  */
 54 | export default class ReactNipple extends Component {
 55 |     /* eslint-disable no-trailing-spaces */
 56 |     /**
 57 |      * Component propTypes
 58 |      *
 59 |      * Any additional (unknown) props will be passed along as attributes of the created DOM element.
 60 |      *
 61 |      * @property {string} className - A css classname for the DOM element
 62 |      * @property {object} options - An object with nipplejs options, see https://github.com/yoannmoinet/nipplejs#options
 63 |      * @property {boolean} static - A shortcut for setting the options `{mode: 'static', position: {top: '50%', left: '50%'}}`. Will override values in the `options` object.
 64 |      * @property {function} onCreated - Callback that is invoked with the created instance
 65 |      * @property {function} onDestroy - Callback that is invoked with the instance that is going to be destroyed
 66 |      * @property {function} onStart - Callback for the 'start' event handler, see https://github.com/yoannmoinet/nipplejs#start
 67 |      * @property {function} onEnd - Callback for the 'end' event handler, see https://github.com/yoannmoinet/nipplejs#end
 68 |      * @property {function} onMove - Callback for the 'move' event handler, see https://github.com/yoannmoinet/nipplejs#move
 69 |      * @property {function} onDir - Callback for the 'dir' event handler, see https://github.com/yoannmoinet/nipplejs#dir
 70 |      * @property {function} onPlain - Callback for the 'plain' event handler, see https://github.com/yoannmoinet/nipplejs#plain
 71 |      * @property {function} onShown - Callback for the 'shown' event handler, see https://github.com/yoannmoinet/nipplejs#shown
 72 |      * @property {function} onHidden - Callback for the 'hidden' event handler, see https://github.com/yoannmoinet/nipplejs#hidden
 73 |      * @property {function} onPressure - Callback for the 'pressure' event handler, see https://github.com/yoannmoinet/nipplejs#pressure
 74 |      */
 75 |     /* eslint-enable no-trailing-spaces */
 76 |     static get propTypes() {
 77 |         return {
 78 |             className: PropTypes.string,
 79 |             options: PropTypes.shape({
 80 |                 color: PropTypes.string,
 81 |                 size: PropTypes.integer,
 82 |                 threshold: PropTypes.float, // before triggering a directional event
 83 |                 fadeTime: PropTypes.integer, // transition time
 84 |                 multitouch: PropTypes.bool,
 85 |                 maxNumberOfNipples: PropTypes.number, // when multitouch, what is too many?
 86 |                 dataOnly: PropTypes.bool, // no dom element whatsoever
 87 |                 position: PropTypes.object, // preset position for 'static' mode
 88 |                 mode: PropTypes.string, // 'dynamic', 'static' or 'semi'
 89 |                 restJoystick: PropTypes.bool,
 90 |                 restOpacity: PropTypes.number, // opacity when not 'dynamic' and rested
 91 |                 catchDistance: PropTypes.number
 92 |             }),
 93 |             static: PropTypes.bool,
 94 |             onStart: PropTypes.func,
 95 |             onEnd: PropTypes.func,
 96 |             onMove: PropTypes.func,
 97 |             onDir: PropTypes.func,
 98 |             onPlain: PropTypes.func,
 99 |             onShown: PropTypes.func,
100 |             onHidden: PropTypes.func,
101 |             onPressure: PropTypes.func,
102 |             onCreated: PropTypes.func,
103 |             onDestroy: PropTypes.func
104 |         };
105 |     }
106 | 
107 |     get ownProps() {
108 |         return [
109 |             'options',
110 |             'static',
111 |             'onStart',
112 |             'onEnd',
113 |             'onMove',
114 |             'onDir',
115 |             'onPlain',
116 |             'onShown',
117 |             'onHidden',
118 |             'onPressure',
119 |             'onCreated'
120 |         ];
121 |     }
122 |     get elementProps() {
123 |         return Object.entries(this.props).reduce((result, [key, value]) => {
124 |             if (this.ownProps.includes(key)) {
125 |                 return result;
126 |             }
127 |             result[key] = value;
128 |             return result;
129 |         }, {});
130 |     }
131 | 
132 |     componentDidUpdate(prevProps) {
133 |         if (!isEqual(prevProps.options, this.props.options)) {
134 |             this.destroyJoystick();
135 |             this.createJoystick();
136 |         }
137 |     }
138 | 
139 |     render() {
140 |         return (
141 |             <div {...this.elementProps} ref={this.handleElement} className={cx('ReactNipple', this.props.className)} />
142 |         );
143 |     }
144 | 
145 |     //-----------------------------------
146 |     //
147 |     // impl
148 |     //
149 |     //-----------------------------------
150 | 
151 |     @autobind
152 |     handleElement(ref) {
153 |         this._element = ref;
154 |         if (ref) {
155 |             this.createJoystick(this.props);
156 |         } else if (this._element) {
157 |             this.destroyJoystick();
158 |         }
159 |     }
160 |     createJoystick(props) {
161 |         const options = {
162 |             zone: this._element,
163 |             ...props.options
164 |         };
165 | 
166 |         if (this.props.static) {
167 |             options.mode = 'static';
168 |             options.position = {
169 |                 top: '50%',
170 |                 left: '50%'
171 |             };
172 |         }
173 | 
174 |         const joystick = nipplejs.create(options);
175 |         joystick.on('start', this.handleJoystickStart);
176 |         joystick.on('end', this.handleJoystickEnd);
177 |         joystick.on('move', this.handleJoystickMove);
178 |         joystick.on('dir', this.handleJoystickDir);
179 |         joystick.on('plain', this.handleJoystickPlain);
180 |         joystick.on('shown', this.handleJoystickShown);
181 |         joystick.on('hidden', this.handleJoystickHidden);
182 |         joystick.on('pressure', this.handleJoystickPressure);
183 | 
184 |         this.joystick = joystick;
185 | 
186 |         if (props.onCreated) {
187 |             props.onCreated(this.joystick);
188 |         }
189 |     }
190 |     destroyJoystick() {
191 |         if (this.joystick) {
192 |             this.joystick.destroy();
193 |             this.joystick = undefined;
194 |         }
195 |     }
196 |     invokeCallback(type, evt, data) {
197 |         if (this.props[type]) {
198 |             this.props[type](evt, data);
199 |         }
200 |     }
201 |     @autobind
202 |     handleJoystickStart(evt, data) {
203 |         this.invokeCallback('onStart', evt, data);
204 |     }
205 |     @autobind
206 |     handleJoystickEnd(evt, data) {
207 |         this.invokeCallback('onEnd', evt, data);
208 |     }
209 |     @autobind
210 |     handleJoystickMove(evt, data) {
211 |         this.invokeCallback('onMove', evt, data);
212 |     }
213 |     @autobind
214 |     handleJoystickDir(evt, data) {
215 |         this.invokeCallback('onDir', evt, data);
216 |     }
217 |     @autobind
218 |     handleJoystickPlain(evt, data) {
219 |         this.invokeCallback('onPlain', evt, data);
220 |     }
221 |     @autobind
222 |     handleJoystickShown(evt, data) {
223 |         this.invokeCallback('onShown', evt, data);
224 |     }
225 |     @autobind
226 |     handleJoystickHidden(evt, data) {
227 |         this.invokeCallback('onHidden', evt, data);
228 |     }
229 |     @autobind
230 |     handleJoystickPressure(evt, data) {
231 |         this.invokeCallback('onPressure', evt, data);
232 |     }
233 | }
234 | 
235 | 236 |
237 | 238 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | -------------------------------------------------------------------------------- /docs/file/src/index.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | src/index.js | my-package API Document 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | Home 18 | Manual 19 | Reference 20 | Source 21 | 22 | 23 | 30 |
31 | 32 | 39 | 40 |

src/index.js

41 |
export default from './ReactNipple';
42 | 
43 | 44 |
45 | 46 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /docs/identifiers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Index | my-package API Document 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | Home 18 | Manual 19 | Reference 20 | Source 21 | 22 | 23 | 30 |
31 | 32 | 39 | 40 |

References

41 |

Class Summary

42 | 43 | 44 | 45 | 46 | 53 | 68 | 72 | 73 | 74 |
Static Public Class Summary
47 | public 48 | 49 | 50 | 51 | 52 | 54 |
55 |

56 | 57 | 58 | ReactNipple 59 |

60 |
61 |
62 | 63 | 64 |

A react wrapper component for nipplejs.

65 |
66 |
67 |
69 | 70 | 71 |
75 |
76 | 77 | 78 | 79 | 80 | 81 |
82 | 83 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /docs/image/badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | document 13 | document 14 | @ratio@ 15 | @ratio@ 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/image/esdoc-logo-mini-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loopmode/react-nipple/1820ee28885947c4c76a20edfa19d94899a0575d/docs/image/esdoc-logo-mini-black.png -------------------------------------------------------------------------------- /docs/image/esdoc-logo-mini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loopmode/react-nipple/1820ee28885947c4c76a20edfa19d94899a0575d/docs/image/esdoc-logo-mini.png -------------------------------------------------------------------------------- /docs/image/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loopmode/react-nipple/1820ee28885947c4c76a20edfa19d94899a0575d/docs/image/github.png -------------------------------------------------------------------------------- /docs/image/manual-badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | manual 13 | manual 14 | @value@ 15 | @value@ 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/image/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loopmode/react-nipple/1820ee28885947c4c76a20edfa19d94899a0575d/docs/image/search.png -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | my-package API Document 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | Home 18 | Manual 19 | Reference 20 | Source 21 | 22 | 23 | 30 |
31 | 32 | 39 | 40 |

react-nipple

41 |

A react wrapper for the nipplejs on-screen-joystick.

42 |

43 |

Installation

44 |
yarn add react-nipple
 45 | # or using npm:
 46 | npm install --save react-nipple
 47 | 
48 |

Resources

49 | 54 |

Usage

55 |

Import and use the component. It supports all options from nipplejs.
It provides callbacks for all supported event types in a camel-cased on-notation, e.g. start -> onStart.

56 |
import React from 'react';
 57 | import ReactNipple from 'react-nipple';
 58 | 
 59 | // optional: include the stylesheet somewhere in your app
 60 | import 'react-nipple/lib/styles.css';
 61 | 
 62 | class Example extends React.Component {
 63 |     render() {
 64 |         return (
 65 |             <div>
 66 |                 <ReactNipple
 67 |                     // supports all nipplejs options
 68 |                     // see https://github.com/yoannmoinet/nipplejs#options
 69 |                     options={{ mode: 'static', position: { top: '50%', left: '50%' } }}
 70 |                     // any unknown props will be passed to the container element, e.g. 'title', 'style' etc
 71 |                     style={{
 72 |                         outline: `1px dashed red`,
 73 |                         width: 150,
 74 |                         height: 150
 75 |                         // if you pass position: 'relative', you don't need to import the stylesheet
 76 |                     }}
 77 |                     // all events supported by nipplejs are available as callbacks
 78 |                     // see https://github.com/yoannmoinet/nipplejs#start
 79 |                     onMove={(evt, data) => console.log(evt, data)}
 80 |                 />
 81 |             </div>
 82 |         );
 83 |     }
 84 | }
 85 | 
86 |

Additional features

87 | 91 |

Demo app

92 |

The repository is a yarn workspace that contains a small demo app next to the actual react-nipples package.
You can play around with the demo after cloning the repository and installing the dependencies in the root folder.

93 |
git clone https://github.com/loopmode/react-nipple.git
 94 | cd react-nipple
 95 | yarn install
 96 | yarn demo
 97 | 

Debug view

98 |

There is a debug view based on the official codepen demo.

99 |

It supports a data prop that accepts the data object you receive with all nipplejs events, and simply renders its values.
Use it to quickly inspect the values.

100 |
import React from 'react';
101 | import ReactNipple from 'react-nipple';
102 | import DebugView from 'react-nipple/lib/DebugView';
103 | 
104 | class ReactNippleExample extends React.Component {
105 |     state = {
106 |         data: {}
107 |     };
108 |     render() {
109 |         return (
110 |             <div>
111 |                 <ReactNipple
112 |                     options={{mode: 'static', position: {top: '50%', left: '50%'}}}
113 |                     style={{
114 |                         outline: `1px dashed red`,
115 |                         width: 150,
116 |                         height: 150
117 |                         position: `relative`
118 |                     }}
119 | 
120 |                     onStart={this.handleEvent}
121 |                     onEnd={this.handleEvent}
122 |                     onMove={this.handleEvent}
123 |                     onDir={this.handleEvent}
124 |                     onPlain={this.handleEvent}
125 |                     onShown={this.handleEvent}
126 |                     onHidden={this.handleEvent}
127 |                     onPressure={this.handleEvent}
128 |                 />
129 |                 <DebugView data={this.state.data} />
130 |             </div>
131 |         );
132 |     }
133 |     handleEvent = (evt, data) => {
134 |         console.log(evt);
135 |         this.setState({ data });
136 |     }
137 | }
138 | 
139 |
140 |
141 | 142 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /docs/manual-badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | manual 13 | manual 14 | 0% 15 | 0% 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/manual/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Manual 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | Home 18 | Manual 19 | Reference 20 | Source 21 | 22 | 23 | 30 |
31 | 32 | 43 | 44 |
45 | 46 | 47 |

48 | 49 |
50 | 51 |
52 |

References

53 |
54 |

References

55 |

Class Summary

56 | 57 | 58 | 59 | 60 | 67 | 82 | 86 | 87 | 88 |
Static Public Class Summary
61 | public 62 | 63 | 64 | 65 | 66 | 68 |
69 |

70 | 71 | 72 | ReactNipple 73 |

74 |
75 |
76 | 77 | 78 |

A react wrapper component for nipplejs.

79 |
80 |
81 |
83 | 84 | 85 |
89 |
90 | 91 | 92 | 93 | 94 | 95 |
96 | 97 |
98 |
99 |
100 |
101 |
102 | 103 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-nipple", 3 | "version": "1.0.0", 4 | "main": "lib/index.js", 5 | "license": "MIT", 6 | "scripts": { 7 | "babel": "babel src --out-dir lib --copy-files", 8 | "eslint": "eslint src", 9 | "esdoc": "esdoc", 10 | "clean": "rm -rf lib/*" 11 | }, 12 | "peerDependencies": { 13 | "react": "^16.4.1", 14 | "react-dom": "^16.4.1" 15 | }, 16 | "dependencies": { 17 | "autobind-decorator": "^2.1.0", 18 | "classnames": "^2.2.6", 19 | "lodash.isequal": "^4.5.0", 20 | "nipplejs": "^0.7.1" 21 | }, 22 | "devDependencies": { 23 | "@loopmode/babel6-base": "^0.0.6", 24 | "react": "^16.4.1" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /docs/script/inherited-summary.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | function toggle(ev) { 3 | var button = ev.target; 4 | var parent = ev.target.parentElement; 5 | while(parent) { 6 | if (parent.tagName === 'TABLE' && parent.classList.contains('summary')) break; 7 | parent = parent.parentElement; 8 | } 9 | 10 | if (!parent) return; 11 | 12 | var tbody = parent.querySelector('tbody'); 13 | if (button.classList.contains('opened')) { 14 | button.classList.remove('opened'); 15 | button.classList.add('closed'); 16 | tbody.style.display = 'none'; 17 | } else { 18 | button.classList.remove('closed'); 19 | button.classList.add('opened'); 20 | tbody.style.display = 'block'; 21 | } 22 | } 23 | 24 | var buttons = document.querySelectorAll('.inherited-summary thead .toggle'); 25 | for (var i = 0; i < buttons.length; i++) { 26 | buttons[i].addEventListener('click', toggle); 27 | } 28 | })(); 29 | -------------------------------------------------------------------------------- /docs/script/inner-link.js: -------------------------------------------------------------------------------- 1 | // inner link(#foo) can not correctly scroll, because page has fixed header, 2 | // so, I manually scroll. 3 | (function(){ 4 | var matched = location.hash.match(/errorLines=([\d,]+)/); 5 | if (matched) return; 6 | 7 | function adjust() { 8 | window.scrollBy(0, -55); 9 | var el = document.querySelector('.inner-link-active'); 10 | if (el) el.classList.remove('inner-link-active'); 11 | 12 | // ``[ ] . ' " @`` are not valid in DOM id. so must escape these. 13 | var id = location.hash.replace(/([\[\].'"@$])/g, '\\$1'); 14 | var el = document.querySelector(id); 15 | if (el) el.classList.add('inner-link-active'); 16 | } 17 | 18 | window.addEventListener('hashchange', adjust); 19 | 20 | if (location.hash) { 21 | setTimeout(adjust, 0); 22 | } 23 | })(); 24 | 25 | (function(){ 26 | var els = document.querySelectorAll('[href^="#"]'); 27 | for (var i = 0; i < els.length; i++) { 28 | var el = els[i]; 29 | el.href = location.href + el.getAttribute('href'); // because el.href is absolute path 30 | } 31 | })(); 32 | -------------------------------------------------------------------------------- /docs/script/manual.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | var matched = location.pathname.match(/\/(manual\/.*?\/.*\.html)$/); 3 | if (!matched) return; 4 | 5 | var currentName = matched[1]; 6 | var cssClass = '.navigation .manual-toc li[data-link="' + currentName + '"]'; 7 | var styleText = cssClass + '{ display: block; }\n'; 8 | var style = document.createElement('style'); 9 | style.textContent = styleText; 10 | document.querySelector('head').appendChild(style); 11 | })(); 12 | -------------------------------------------------------------------------------- /docs/script/patch-for-local.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | if (location.protocol === 'file:') { 3 | var elms = document.querySelectorAll('a[href="./"]'); 4 | for (var i = 0; i < elms.length; i++) { 5 | elms[i].href = './index.html'; 6 | } 7 | } 8 | })(); 9 | -------------------------------------------------------------------------------- /docs/script/prettify/Apache-License-2.0.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /docs/script/prettify/prettify.js: -------------------------------------------------------------------------------- 1 | var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; 2 | (function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= 3 | [],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), 9 | l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, 10 | q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, 11 | q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, 12 | "");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), 13 | a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} 14 | for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], 18 | "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], 19 | H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], 20 | J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ 21 | I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), 22 | ["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", 23 | /^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), 24 | ["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", 25 | hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= 26 | !k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p' + pair[2] + ''); 35 | } 36 | } 37 | 38 | var innerHTML = ''; 39 | for (kind in html) { 40 | var list = html[kind]; 41 | if (!list.length) continue; 42 | innerHTML += '
  • ' + kind + '
  • \n' + list.join('\n'); 43 | } 44 | result.innerHTML = innerHTML; 45 | if (innerHTML) result.style.display = 'block'; 46 | selectedIndex = -1; 47 | }); 48 | 49 | // down, up and enter key are pressed, select search result. 50 | input.addEventListener('keydown', function(ev){ 51 | if (ev.keyCode === 40) { 52 | // arrow down 53 | var current = result.children[selectedIndex]; 54 | var selected = result.children[selectedIndex + 1]; 55 | if (selected && selected.classList.contains('search-separator')) { 56 | var selected = result.children[selectedIndex + 2]; 57 | selectedIndex++; 58 | } 59 | 60 | if (selected) { 61 | if (current) current.classList.remove('selected'); 62 | selectedIndex++; 63 | selected.classList.add('selected'); 64 | } 65 | } else if (ev.keyCode === 38) { 66 | // arrow up 67 | var current = result.children[selectedIndex]; 68 | var selected = result.children[selectedIndex - 1]; 69 | if (selected && selected.classList.contains('search-separator')) { 70 | var selected = result.children[selectedIndex - 2]; 71 | selectedIndex--; 72 | } 73 | 74 | if (selected) { 75 | if (current) current.classList.remove('selected'); 76 | selectedIndex--; 77 | selected.classList.add('selected'); 78 | } 79 | } else if (ev.keyCode === 13) { 80 | // enter 81 | var current = result.children[selectedIndex]; 82 | if (current) { 83 | var link = current.querySelector('a'); 84 | if (link) location.href = link.href; 85 | } 86 | } else { 87 | return; 88 | } 89 | 90 | ev.preventDefault(); 91 | }); 92 | 93 | // select search result when search result is mouse over. 94 | result.addEventListener('mousemove', function(ev){ 95 | var current = result.children[selectedIndex]; 96 | if (current) current.classList.remove('selected'); 97 | 98 | var li = ev.target; 99 | while (li) { 100 | if (li.nodeName === 'LI') break; 101 | li = li.parentElement; 102 | } 103 | 104 | if (li) { 105 | selectedIndex = Array.prototype.indexOf.call(result.children, li); 106 | li.classList.add('selected'); 107 | } 108 | }); 109 | 110 | // clear search result when body is clicked. 111 | document.body.addEventListener('click', function(ev){ 112 | selectedIndex = -1; 113 | result.style.display = 'none'; 114 | result.innerHTML = ''; 115 | }); 116 | 117 | })(); 118 | -------------------------------------------------------------------------------- /docs/script/search_index.js: -------------------------------------------------------------------------------- 1 | window.esdocSearchIndex = [ 2 | [ 3 | "react-nipple/src/reactnipple.js~reactnipple", 4 | "class/src/ReactNipple.js~ReactNipple.html", 5 | "ReactNipple react-nipple/src/ReactNipple.js", 6 | "class" 7 | ], 8 | [ 9 | "builtinexternal/ecmascriptexternal.js~array", 10 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", 11 | "BuiltinExternal/ECMAScriptExternal.js~Array", 12 | "external" 13 | ], 14 | [ 15 | "builtinexternal/ecmascriptexternal.js~arraybuffer", 16 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer", 17 | "BuiltinExternal/ECMAScriptExternal.js~ArrayBuffer", 18 | "external" 19 | ], 20 | [ 21 | "builtinexternal/ecmascriptexternal.js~boolean", 22 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", 23 | "BuiltinExternal/ECMAScriptExternal.js~Boolean", 24 | "external" 25 | ], 26 | [ 27 | "builtinexternal/ecmascriptexternal.js~dataview", 28 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView", 29 | "BuiltinExternal/ECMAScriptExternal.js~DataView", 30 | "external" 31 | ], 32 | [ 33 | "builtinexternal/ecmascriptexternal.js~date", 34 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date", 35 | "BuiltinExternal/ECMAScriptExternal.js~Date", 36 | "external" 37 | ], 38 | [ 39 | "builtinexternal/ecmascriptexternal.js~error", 40 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error", 41 | "BuiltinExternal/ECMAScriptExternal.js~Error", 42 | "external" 43 | ], 44 | [ 45 | "builtinexternal/ecmascriptexternal.js~evalerror", 46 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError", 47 | "BuiltinExternal/ECMAScriptExternal.js~EvalError", 48 | "external" 49 | ], 50 | [ 51 | "builtinexternal/ecmascriptexternal.js~float32array", 52 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array", 53 | "BuiltinExternal/ECMAScriptExternal.js~Float32Array", 54 | "external" 55 | ], 56 | [ 57 | "builtinexternal/ecmascriptexternal.js~float64array", 58 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array", 59 | "BuiltinExternal/ECMAScriptExternal.js~Float64Array", 60 | "external" 61 | ], 62 | [ 63 | "builtinexternal/ecmascriptexternal.js~function", 64 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", 65 | "BuiltinExternal/ECMAScriptExternal.js~Function", 66 | "external" 67 | ], 68 | [ 69 | "builtinexternal/ecmascriptexternal.js~generator", 70 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator", 71 | "BuiltinExternal/ECMAScriptExternal.js~Generator", 72 | "external" 73 | ], 74 | [ 75 | "builtinexternal/ecmascriptexternal.js~generatorfunction", 76 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction", 77 | "BuiltinExternal/ECMAScriptExternal.js~GeneratorFunction", 78 | "external" 79 | ], 80 | [ 81 | "builtinexternal/ecmascriptexternal.js~infinity", 82 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity", 83 | "BuiltinExternal/ECMAScriptExternal.js~Infinity", 84 | "external" 85 | ], 86 | [ 87 | "builtinexternal/ecmascriptexternal.js~int16array", 88 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array", 89 | "BuiltinExternal/ECMAScriptExternal.js~Int16Array", 90 | "external" 91 | ], 92 | [ 93 | "builtinexternal/ecmascriptexternal.js~int32array", 94 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array", 95 | "BuiltinExternal/ECMAScriptExternal.js~Int32Array", 96 | "external" 97 | ], 98 | [ 99 | "builtinexternal/ecmascriptexternal.js~int8array", 100 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array", 101 | "BuiltinExternal/ECMAScriptExternal.js~Int8Array", 102 | "external" 103 | ], 104 | [ 105 | "builtinexternal/ecmascriptexternal.js~internalerror", 106 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError", 107 | "BuiltinExternal/ECMAScriptExternal.js~InternalError", 108 | "external" 109 | ], 110 | [ 111 | "builtinexternal/ecmascriptexternal.js~json", 112 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON", 113 | "BuiltinExternal/ECMAScriptExternal.js~JSON", 114 | "external" 115 | ], 116 | [ 117 | "builtinexternal/ecmascriptexternal.js~map", 118 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map", 119 | "BuiltinExternal/ECMAScriptExternal.js~Map", 120 | "external" 121 | ], 122 | [ 123 | "builtinexternal/ecmascriptexternal.js~nan", 124 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN", 125 | "BuiltinExternal/ECMAScriptExternal.js~NaN", 126 | "external" 127 | ], 128 | [ 129 | "builtinexternal/ecmascriptexternal.js~number", 130 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", 131 | "BuiltinExternal/ECMAScriptExternal.js~Number", 132 | "external" 133 | ], 134 | [ 135 | "builtinexternal/ecmascriptexternal.js~object", 136 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", 137 | "BuiltinExternal/ECMAScriptExternal.js~Object", 138 | "external" 139 | ], 140 | [ 141 | "builtinexternal/ecmascriptexternal.js~promise", 142 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise", 143 | "BuiltinExternal/ECMAScriptExternal.js~Promise", 144 | "external" 145 | ], 146 | [ 147 | "builtinexternal/ecmascriptexternal.js~proxy", 148 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy", 149 | "BuiltinExternal/ECMAScriptExternal.js~Proxy", 150 | "external" 151 | ], 152 | [ 153 | "builtinexternal/ecmascriptexternal.js~rangeerror", 154 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError", 155 | "BuiltinExternal/ECMAScriptExternal.js~RangeError", 156 | "external" 157 | ], 158 | [ 159 | "builtinexternal/ecmascriptexternal.js~referenceerror", 160 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError", 161 | "BuiltinExternal/ECMAScriptExternal.js~ReferenceError", 162 | "external" 163 | ], 164 | [ 165 | "builtinexternal/ecmascriptexternal.js~reflect", 166 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect", 167 | "BuiltinExternal/ECMAScriptExternal.js~Reflect", 168 | "external" 169 | ], 170 | [ 171 | "builtinexternal/ecmascriptexternal.js~regexp", 172 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp", 173 | "BuiltinExternal/ECMAScriptExternal.js~RegExp", 174 | "external" 175 | ], 176 | [ 177 | "builtinexternal/ecmascriptexternal.js~set", 178 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set", 179 | "BuiltinExternal/ECMAScriptExternal.js~Set", 180 | "external" 181 | ], 182 | [ 183 | "builtinexternal/ecmascriptexternal.js~string", 184 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", 185 | "BuiltinExternal/ECMAScriptExternal.js~String", 186 | "external" 187 | ], 188 | [ 189 | "builtinexternal/ecmascriptexternal.js~symbol", 190 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol", 191 | "BuiltinExternal/ECMAScriptExternal.js~Symbol", 192 | "external" 193 | ], 194 | [ 195 | "builtinexternal/ecmascriptexternal.js~syntaxerror", 196 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError", 197 | "BuiltinExternal/ECMAScriptExternal.js~SyntaxError", 198 | "external" 199 | ], 200 | [ 201 | "builtinexternal/ecmascriptexternal.js~typeerror", 202 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError", 203 | "BuiltinExternal/ECMAScriptExternal.js~TypeError", 204 | "external" 205 | ], 206 | [ 207 | "builtinexternal/ecmascriptexternal.js~urierror", 208 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError", 209 | "BuiltinExternal/ECMAScriptExternal.js~URIError", 210 | "external" 211 | ], 212 | [ 213 | "builtinexternal/ecmascriptexternal.js~uint16array", 214 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array", 215 | "BuiltinExternal/ECMAScriptExternal.js~Uint16Array", 216 | "external" 217 | ], 218 | [ 219 | "builtinexternal/ecmascriptexternal.js~uint32array", 220 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array", 221 | "BuiltinExternal/ECMAScriptExternal.js~Uint32Array", 222 | "external" 223 | ], 224 | [ 225 | "builtinexternal/ecmascriptexternal.js~uint8array", 226 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array", 227 | "BuiltinExternal/ECMAScriptExternal.js~Uint8Array", 228 | "external" 229 | ], 230 | [ 231 | "builtinexternal/ecmascriptexternal.js~uint8clampedarray", 232 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray", 233 | "BuiltinExternal/ECMAScriptExternal.js~Uint8ClampedArray", 234 | "external" 235 | ], 236 | [ 237 | "builtinexternal/ecmascriptexternal.js~weakmap", 238 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap", 239 | "BuiltinExternal/ECMAScriptExternal.js~WeakMap", 240 | "external" 241 | ], 242 | [ 243 | "builtinexternal/ecmascriptexternal.js~weakset", 244 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet", 245 | "BuiltinExternal/ECMAScriptExternal.js~WeakSet", 246 | "external" 247 | ], 248 | [ 249 | "builtinexternal/ecmascriptexternal.js~boolean", 250 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", 251 | "BuiltinExternal/ECMAScriptExternal.js~boolean", 252 | "external" 253 | ], 254 | [ 255 | "builtinexternal/ecmascriptexternal.js~function", 256 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", 257 | "BuiltinExternal/ECMAScriptExternal.js~function", 258 | "external" 259 | ], 260 | [ 261 | "builtinexternal/ecmascriptexternal.js~null", 262 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null", 263 | "BuiltinExternal/ECMAScriptExternal.js~null", 264 | "external" 265 | ], 266 | [ 267 | "builtinexternal/ecmascriptexternal.js~number", 268 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", 269 | "BuiltinExternal/ECMAScriptExternal.js~number", 270 | "external" 271 | ], 272 | [ 273 | "builtinexternal/ecmascriptexternal.js~object", 274 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", 275 | "BuiltinExternal/ECMAScriptExternal.js~object", 276 | "external" 277 | ], 278 | [ 279 | "builtinexternal/ecmascriptexternal.js~string", 280 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", 281 | "BuiltinExternal/ECMAScriptExternal.js~string", 282 | "external" 283 | ], 284 | [ 285 | "builtinexternal/ecmascriptexternal.js~undefined", 286 | "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined", 287 | "BuiltinExternal/ECMAScriptExternal.js~undefined", 288 | "external" 289 | ], 290 | [ 291 | "builtinexternal/webapiexternal.js~audiocontext", 292 | "https://developer.mozilla.org/en/docs/Web/API/AudioContext", 293 | "BuiltinExternal/WebAPIExternal.js~AudioContext", 294 | "external" 295 | ], 296 | [ 297 | "builtinexternal/webapiexternal.js~canvasrenderingcontext2d", 298 | "https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D", 299 | "BuiltinExternal/WebAPIExternal.js~CanvasRenderingContext2D", 300 | "external" 301 | ], 302 | [ 303 | "builtinexternal/webapiexternal.js~documentfragment", 304 | "https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment", 305 | "BuiltinExternal/WebAPIExternal.js~DocumentFragment", 306 | "external" 307 | ], 308 | [ 309 | "builtinexternal/webapiexternal.js~element", 310 | "https://developer.mozilla.org/en-US/docs/Web/API/Element", 311 | "BuiltinExternal/WebAPIExternal.js~Element", 312 | "external" 313 | ], 314 | [ 315 | "builtinexternal/webapiexternal.js~event", 316 | "https://developer.mozilla.org/en-US/docs/Web/API/Event", 317 | "BuiltinExternal/WebAPIExternal.js~Event", 318 | "external" 319 | ], 320 | [ 321 | "builtinexternal/webapiexternal.js~node", 322 | "https://developer.mozilla.org/en-US/docs/Web/API/Node", 323 | "BuiltinExternal/WebAPIExternal.js~Node", 324 | "external" 325 | ], 326 | [ 327 | "builtinexternal/webapiexternal.js~nodelist", 328 | "https://developer.mozilla.org/en-US/docs/Web/API/NodeList", 329 | "BuiltinExternal/WebAPIExternal.js~NodeList", 330 | "external" 331 | ], 332 | [ 333 | "builtinexternal/webapiexternal.js~xmlhttprequest", 334 | "https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest", 335 | "BuiltinExternal/WebAPIExternal.js~XMLHttpRequest", 336 | "external" 337 | ], 338 | [ 339 | "src/debugview.js", 340 | "file/src/DebugView.js.html", 341 | "src/DebugView.js", 342 | "file" 343 | ], 344 | [ 345 | "src/reactnipple.js", 346 | "file/src/ReactNipple.js.html", 347 | "src/ReactNipple.js", 348 | "file" 349 | ], 350 | [ 351 | "src/reactnipple.js~reactnipple.proptypes", 352 | "class/src/ReactNipple.js~ReactNipple.html#static-get-propTypes", 353 | "src/ReactNipple.js~ReactNipple.propTypes", 354 | "member" 355 | ], 356 | [ 357 | "src/index.js", 358 | "file/src/index.js.html", 359 | "src/index.js", 360 | "file" 361 | ] 362 | ] -------------------------------------------------------------------------------- /docs/script/test-summary.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | function toggle(ev) { 3 | var button = ev.target; 4 | var parent = ev.target.parentElement; 5 | while(parent) { 6 | if (parent.tagName === 'TR' && parent.classList.contains('test-describe')) break; 7 | parent = parent.parentElement; 8 | } 9 | 10 | if (!parent) return; 11 | 12 | var direction; 13 | if (button.classList.contains('opened')) { 14 | button.classList.remove('opened'); 15 | button.classList.add('closed'); 16 | direction = 'closed'; 17 | } else { 18 | button.classList.remove('closed'); 19 | button.classList.add('opened'); 20 | direction = 'opened'; 21 | } 22 | 23 | var targetDepth = parseInt(parent.dataset.testDepth, 10) + 1; 24 | var nextElement = parent.nextElementSibling; 25 | while (nextElement) { 26 | var depth = parseInt(nextElement.dataset.testDepth, 10); 27 | if (depth >= targetDepth) { 28 | if (direction === 'opened') { 29 | if (depth === targetDepth) nextElement.style.display = ''; 30 | } else if (direction === 'closed') { 31 | nextElement.style.display = 'none'; 32 | var innerButton = nextElement.querySelector('.toggle'); 33 | if (innerButton && innerButton.classList.contains('opened')) { 34 | innerButton.classList.remove('opened'); 35 | innerButton.classList.add('closed'); 36 | } 37 | } 38 | } else { 39 | break; 40 | } 41 | nextElement = nextElement.nextElementSibling; 42 | } 43 | } 44 | 45 | var buttons = document.querySelectorAll('.test-summary tr.test-describe .toggle'); 46 | for (var i = 0; i < buttons.length; i++) { 47 | buttons[i].addEventListener('click', toggle); 48 | } 49 | 50 | var topDescribes = document.querySelectorAll('.test-summary tr[data-test-depth="0"]'); 51 | for (var i = 0; i < topDescribes.length; i++) { 52 | topDescribes[i].style.display = ''; 53 | } 54 | })(); 55 | -------------------------------------------------------------------------------- /docs/source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Source | my-package API Document 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
    17 | Home 18 | Manual 19 | Reference 20 | Source 21 | 22 | 23 | 30 |
    31 | 32 | 39 | 40 |

    Source 2/2

    41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 |
    FileIdentifierDocumentSizeLinesUpdated
    src/DebugView.js--3510 byte882018-07-05 10:18:47 (UTC)
    src/ReactNipple.jsReactNipple100 %2/27150 byte1932018-07-05 10:46:34 (UTC)
    src/index.js--38 byte12018-07-05 10:05:47 (UTC)
    81 |
    82 | 83 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "react-nipple-workpace", 4 | "version": "1.0.0", 5 | "main": "index.js", 6 | "license": "MIT", 7 | "workspaces": [ 8 | "packages/*" 9 | ], 10 | "scripts": { 11 | "demo": "cd packages/demo && yarn start", 12 | "docs": "cd packages/react-nipple && yarn docs && cp -r ./docs ../..", 13 | "nuke": "find . -name node_modules -type d -exec rm -rf '{}' + && yarn" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/demo/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /packages/demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "demo", 4 | "version": "0.1.0", 5 | "private": true, 6 | "dependencies": { 7 | "react": "^16.4.1", 8 | "react-dom": "^16.4.2", 9 | "react-scripts": "1.1.4" 10 | }, 11 | "scripts": { 12 | "start": "react-scripts start", 13 | "build": "react-scripts build", 14 | "test": "react-scripts test --env=jsdom", 15 | "eject": "react-scripts eject" 16 | } 17 | } -------------------------------------------------------------------------------- /packages/demo/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loopmode/react-nipple/1820ee28885947c4c76a20edfa19d94899a0575d/packages/demo/public/favicon.ico -------------------------------------------------------------------------------- /packages/demo/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 22 | React App 23 | 24 | 25 | 28 |
    29 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /packages/demo/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /packages/demo/src/App.css: -------------------------------------------------------------------------------- 1 | .App-logo { 2 | animation: App-logo-spin infinite 20s linear; 3 | height: 80px; 4 | } 5 | 6 | .App-header { 7 | background-color: #222; 8 | height: 150px; 9 | padding: 20px; 10 | color: white; 11 | text-align: center; 12 | } 13 | 14 | .App-title { 15 | font-size: 1.5em; 16 | } 17 | 18 | @keyframes App-logo-spin { 19 | from { 20 | transform: rotate(0deg); 21 | } 22 | to { 23 | transform: rotate(360deg); 24 | } 25 | } 26 | 27 | .App-examples { 28 | display: flex; 29 | } 30 | 31 | .NippleExample { 32 | flex: 1; 33 | } 34 | 35 | .NippleExample .debug { 36 | display: flex; 37 | } 38 | .NippleExample ul, 39 | .NippleExample li { 40 | text-align: left; 41 | } 42 | -------------------------------------------------------------------------------- /packages/demo/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import logo from "./logo.svg"; 3 | import "./App.css"; 4 | 5 | import ReactNippleExample from "./ReactNippleExample"; 6 | 7 | class App extends Component { 8 | render() { 9 | return ( 10 |
    11 |
    12 | logo 13 |

    Welcome to React

    14 |
    15 |
    16 | 22 | 32 | 42 |
    43 |
    44 | ); 45 | } 46 | } 47 | 48 | export default App; 49 | -------------------------------------------------------------------------------- /packages/demo/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/demo/src/ReactNippleExample.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import PropTypes from "prop-types"; 3 | 4 | import ReactNipple from "react-nipple"; 5 | import DebugView from "react-nipple/lib/DebugView"; 6 | import "react-nipple/lib/styles.css"; 7 | 8 | export default class ReactNippleExample extends Component { 9 | static propTypes = { 10 | title: PropTypes.string, 11 | width: PropTypes.number, 12 | height: PropTypes.number, 13 | options: PropTypes.object 14 | }; 15 | state = { 16 | data: undefined 17 | }; 18 | render() { 19 | return ( 20 |
    21 |

    {this.props.title}

    22 | 39 | 40 |
    41 | ); 42 | } 43 | 44 | handleJoystickStart = (evt, data) => { 45 | this.setState({ data }); 46 | }; 47 | handleJoystickEnd = (evt, data) => { 48 | this.setState({ data }); 49 | }; 50 | handleJoystickMove = (evt, data) => { 51 | this.setState({ data }); 52 | }; 53 | handleJoystickDir = (evt, data) => { 54 | this.setState({ data }); 55 | }; 56 | handleJoystickPlain = (evt, data) => { 57 | this.setState({ data }); 58 | }; 59 | handleJoystickShown = (evt, data) => { 60 | this.setState({ data }); 61 | }; 62 | handleJoystickHidden = (evt, data) => { 63 | this.setState({ data }); 64 | }; 65 | handleJoystickPressure = (evt, data) => { 66 | this.setState({ data }); 67 | }; 68 | } 69 | -------------------------------------------------------------------------------- /packages/demo/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /packages/demo/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import registerServiceWorker from './registerServiceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | registerServiceWorker(); 9 | -------------------------------------------------------------------------------- /packages/demo/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/demo/src/registerServiceWorker.js: -------------------------------------------------------------------------------- 1 | // In production, we register a service worker to serve assets from local cache. 2 | 3 | // This lets the app load faster on subsequent visits in production, and gives 4 | // it offline capabilities. However, it also means that developers (and users) 5 | // will only see deployed updates on the "N+1" visit to a page, since previously 6 | // cached resources are updated in the background. 7 | 8 | // To learn more about the benefits of this model, read https://goo.gl/KwvDNy. 9 | // This link also includes instructions on opting out of this behavior. 10 | 11 | const isLocalhost = Boolean( 12 | window.location.hostname === 'localhost' || 13 | // [::1] is the IPv6 localhost address. 14 | window.location.hostname === '[::1]' || 15 | // 127.0.0.1/8 is considered localhost for IPv4. 16 | window.location.hostname.match( 17 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 18 | ) 19 | ); 20 | 21 | export default function register() { 22 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 23 | // The URL constructor is available in all browsers that support SW. 24 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location); 25 | if (publicUrl.origin !== window.location.origin) { 26 | // Our service worker won't work if PUBLIC_URL is on a different origin 27 | // from what our page is served on. This might happen if a CDN is used to 28 | // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374 29 | return; 30 | } 31 | 32 | window.addEventListener('load', () => { 33 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 34 | 35 | if (isLocalhost) { 36 | // This is running on localhost. Lets check if a service worker still exists or not. 37 | checkValidServiceWorker(swUrl); 38 | 39 | // Add some additional logging to localhost, pointing developers to the 40 | // service worker/PWA documentation. 41 | navigator.serviceWorker.ready.then(() => { 42 | console.log( 43 | 'This web app is being served cache-first by a service ' + 44 | 'worker. To learn more, visit https://goo.gl/SC7cgQ' 45 | ); 46 | }); 47 | } else { 48 | // Is not local host. Just register service worker 49 | registerValidSW(swUrl); 50 | } 51 | }); 52 | } 53 | } 54 | 55 | function registerValidSW(swUrl) { 56 | navigator.serviceWorker 57 | .register(swUrl) 58 | .then(registration => { 59 | registration.onupdatefound = () => { 60 | const installingWorker = registration.installing; 61 | installingWorker.onstatechange = () => { 62 | if (installingWorker.state === 'installed') { 63 | if (navigator.serviceWorker.controller) { 64 | // At this point, the old content will have been purged and 65 | // the fresh content will have been added to the cache. 66 | // It's the perfect time to display a "New content is 67 | // available; please refresh." message in your web app. 68 | console.log('New content is available; please refresh.'); 69 | } else { 70 | // At this point, everything has been precached. 71 | // It's the perfect time to display a 72 | // "Content is cached for offline use." message. 73 | console.log('Content is cached for offline use.'); 74 | } 75 | } 76 | }; 77 | }; 78 | }) 79 | .catch(error => { 80 | console.error('Error during service worker registration:', error); 81 | }); 82 | } 83 | 84 | function checkValidServiceWorker(swUrl) { 85 | // Check if the service worker can be found. If it can't reload the page. 86 | fetch(swUrl) 87 | .then(response => { 88 | // Ensure service worker exists, and that we really are getting a JS file. 89 | if ( 90 | response.status === 404 || 91 | response.headers.get('content-type').indexOf('javascript') === -1 92 | ) { 93 | // No service worker found. Probably a different app. Reload the page. 94 | navigator.serviceWorker.ready.then(registration => { 95 | registration.unregister().then(() => { 96 | window.location.reload(); 97 | }); 98 | }); 99 | } else { 100 | // Service worker found. Proceed as normal. 101 | registerValidSW(swUrl); 102 | } 103 | }) 104 | .catch(() => { 105 | console.log( 106 | 'No internet connection found. App is running in offline mode.' 107 | ); 108 | }); 109 | } 110 | 111 | export function unregister() { 112 | if ('serviceWorker' in navigator) { 113 | navigator.serviceWorker.ready.then(registration => { 114 | registration.unregister(); 115 | }); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /packages/react-nipple/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@loopmode/babel6-base/.babelrc" 3 | } 4 | -------------------------------------------------------------------------------- /packages/react-nipple/.esdoc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('@loopmode/babel6-base/esdoc.config') 3 | } -------------------------------------------------------------------------------- /packages/react-nipple/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@loopmode/react" 3 | } -------------------------------------------------------------------------------- /packages/react-nipple/.gitignore: -------------------------------------------------------------------------------- 1 | /docs 2 | -------------------------------------------------------------------------------- /packages/react-nipple/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.1 2 | 3 | - Add `prepublishOnly` script 4 | - Update docs and readme 5 | 6 | # 1.0.0 7 | 8 | - Init 9 | -------------------------------------------------------------------------------- /packages/react-nipple/README.md: -------------------------------------------------------------------------------- 1 | # react-nipple 2 | 3 | A react wrapper for the [nipplejs](https://www.npmjs.com/package/nipplejs) on-screen-joystick. 4 | 5 | 6 | 7 | ### Resources 8 | 9 | - Github repository: [https://github.com/loopmode/react-nipple](https://github.com/loopmode/react-nipple) 10 | - NPM package: [https://www.npmjs.com/package/react-nipple](https://www.npmjs.com/package/react-nipple) 11 | - Docs: [https://loopmode.github.io/react-nipple/](https://loopmode.github.io/react-nipple/) 12 | 13 | ## Installation 14 | 15 | ```bash 16 | yarn add react-nipple 17 | # or using npm: 18 | npm install --save react-nipple 19 | ``` 20 | 21 | ## Usage 22 | 23 | Import and use the component. It supports all `options` from `nipplejs`. 24 | It provides callbacks for all supported event types in a camel-cased `on`-notation, e.g. `start` -> `onStart`. 25 | 26 | ```javascript 27 | import React from 'react'; 28 | import ReactNipple from 'react-nipple'; 29 | 30 | // optional: include the stylesheet somewhere in your app 31 | import 'react-nipple/lib/styles.css'; 32 | 33 | class Example extends React.Component { 34 | render() { 35 | return ( 36 |
    37 | console.log(evt, data)} 51 | /> 52 |
    53 | ); 54 | } 55 | } 56 | ``` 57 | 58 | ### Additional features 59 | 60 | - There is an additional `onCreated` callback that receives the created `nipplejs` instance - you might want to use it for direct access to instance methods etc. 61 | - You can pass the boolean `static` flag as a prop, which is a shortcut for `options={{mode: 'static', position: {top: '50%', let: '50%'}}}` 62 | 63 | ## Demo app 64 | 65 | The repository is a yarn workspace that contains a small demo app next to the actual `react-nipples` package. 66 | You can play around with the demo after cloning the repository and installing the dependencies in the root folder. 67 | 68 | ``` 69 | git clone https://github.com/loopmode/react-nipple.git 70 | cd react-nipple 71 | yarn install 72 | yarn demo 73 | ``` 74 | 75 | ## Debug view 76 | 77 | There is a debug view based on the official [codepen demo](https://codepen.io/YoannM/pen/gapmMG). 78 | 79 | It supports a `data` prop that accepts the `data` object you receive with all `nipplejs` events, and simply renders its values. 80 | Use it to quickly inspect the values. 81 | 82 | ```javascript 83 | import React from 'react'; 84 | import ReactNipple from 'react-nipple'; 85 | import DebugView from 'react-nipple/lib/DebugView'; 86 | 87 | export default class DebugExample extends React.Component { 88 | state = { 89 | data: {} 90 | }; 91 | render() { 92 | return ( 93 |
    94 | 112 | 113 |
    114 | ); 115 | } 116 | handleEvent = (evt, data) => { 117 | console.log(evt); 118 | this.setState({ data }); 119 | }; 120 | } 121 | ``` 122 | -------------------------------------------------------------------------------- /packages/react-nipple/lib/DebugView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9 | 10 | var _class, _temp; 11 | 12 | var _react = require('react'); 13 | 14 | var _react2 = _interopRequireDefault(_react); 15 | 16 | var _propTypes = require('prop-types'); 17 | 18 | var _propTypes2 = _interopRequireDefault(_propTypes); 19 | 20 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 21 | 22 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 23 | 24 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 25 | 26 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 27 | 28 | var DebugView = (_temp = _class = function (_Component) { 29 | _inherits(DebugView, _Component); 30 | 31 | function DebugView() { 32 | _classCallCheck(this, DebugView); 33 | 34 | return _possibleConstructorReturn(this, (DebugView.__proto__ || Object.getPrototypeOf(DebugView)).apply(this, arguments)); 35 | } 36 | 37 | _createClass(DebugView, [{ 38 | key: 'render', 39 | value: function render() { 40 | var _ref = this.props.data || {}, 41 | _ref$position = _ref.position, 42 | position = _ref$position === undefined ? {} : _ref$position, 43 | force = _ref.force, 44 | pressure = _ref.pressure, 45 | distance = _ref.distance, 46 | _ref$angle = _ref.angle, 47 | angle = _ref$angle === undefined ? {} : _ref$angle, 48 | _ref$direction = _ref.direction, 49 | direction = _ref$direction === undefined ? {} : _ref$direction; 50 | 51 | return _react2.default.createElement( 52 | 'div', 53 | { className: 'debug' }, 54 | _react2.default.createElement( 55 | 'ul', 56 | null, 57 | _react2.default.createElement( 58 | 'li', 59 | { className: 'position' }, 60 | 'position :', 61 | _react2.default.createElement( 62 | 'ul', 63 | null, 64 | _react2.default.createElement( 65 | 'li', 66 | { className: 'x' }, 67 | 'x :', 68 | _react2.default.createElement('span', { className: 'data', children: position.x }) 69 | ), 70 | _react2.default.createElement( 71 | 'li', 72 | { className: 'y' }, 73 | 'y :', 74 | _react2.default.createElement('span', { className: 'data', children: position.y }) 75 | ) 76 | ) 77 | ), 78 | _react2.default.createElement( 79 | 'li', 80 | { className: 'force' }, 81 | 'force : ', 82 | _react2.default.createElement('span', { className: 'data', children: force }) 83 | ), 84 | _react2.default.createElement( 85 | 'li', 86 | { className: 'pressure' }, 87 | 'pressure : ', 88 | _react2.default.createElement('span', { className: 'data', children: pressure }) 89 | ), 90 | _react2.default.createElement( 91 | 'li', 92 | { className: 'distance' }, 93 | 'distance : ', 94 | _react2.default.createElement('span', { className: 'data', children: distance }) 95 | ), 96 | _react2.default.createElement( 97 | 'li', 98 | { className: 'angle' }, 99 | 'angle :', 100 | _react2.default.createElement( 101 | 'ul', 102 | null, 103 | _react2.default.createElement( 104 | 'li', 105 | { className: 'radian' }, 106 | 'radian :', 107 | _react2.default.createElement('span', { className: 'data', children: angle.radian }) 108 | ), 109 | _react2.default.createElement( 110 | 'li', 111 | { className: 'degree' }, 112 | 'degree :', 113 | _react2.default.createElement('span', { className: 'data', children: angle.degree }) 114 | ) 115 | ) 116 | ), 117 | _react2.default.createElement( 118 | 'li', 119 | { className: 'direction' }, 120 | 'direction :', 121 | _react2.default.createElement( 122 | 'ul', 123 | null, 124 | _react2.default.createElement( 125 | 'li', 126 | { className: 'x' }, 127 | 'x :', 128 | _react2.default.createElement('span', { className: 'data', children: direction.x }) 129 | ), 130 | _react2.default.createElement( 131 | 'li', 132 | { className: 'y' }, 133 | 'y :', 134 | _react2.default.createElement('span', { className: 'data', children: direction.y }) 135 | ), 136 | _react2.default.createElement( 137 | 'li', 138 | { className: 'angle' }, 139 | 'angle :', 140 | _react2.default.createElement('span', { className: 'data', children: direction.angle }) 141 | ) 142 | ) 143 | ) 144 | ), 145 | _react2.default.createElement('div', { className: 'dump' }) 146 | ); 147 | } 148 | }]); 149 | 150 | return DebugView; 151 | }(_react.Component), _class.propTypes = { 152 | data: _propTypes2.default.shape({ 153 | position: _propTypes2.default.shape({ 154 | x: _propTypes2.default.number, 155 | y: _propTypes2.default.number 156 | }), 157 | angle: _propTypes2.default.shape({ 158 | radian: _propTypes2.default.number, 159 | degree: _propTypes2.default.number 160 | }), 161 | direction: _propTypes2.default.shape({ 162 | x: _propTypes2.default.number, 163 | y: _propTypes2.default.number, 164 | angle: _propTypes2.default.number 165 | }), 166 | force: _propTypes2.default.number, 167 | pressure: _propTypes2.default.number, 168 | distance: _propTypes2.default.number 169 | }) 170 | }, _temp); 171 | exports.default = DebugView; -------------------------------------------------------------------------------- /packages/react-nipple/lib/ReactNipple.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); 9 | 10 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; 11 | 12 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 13 | 14 | var _desc, _value, _class; 15 | 16 | var _nipplejs = require('nipplejs'); 17 | 18 | var _nipplejs2 = _interopRequireDefault(_nipplejs); 19 | 20 | var _autobindDecorator = require('autobind-decorator'); 21 | 22 | var _autobindDecorator2 = _interopRequireDefault(_autobindDecorator); 23 | 24 | var _lodash = require('lodash.isequal'); 25 | 26 | var _lodash2 = _interopRequireDefault(_lodash); 27 | 28 | var _propTypes = require('prop-types'); 29 | 30 | var _propTypes2 = _interopRequireDefault(_propTypes); 31 | 32 | var _react = require('react'); 33 | 34 | var _react2 = _interopRequireDefault(_react); 35 | 36 | var _classnames = require('classnames'); 37 | 38 | var _classnames2 = _interopRequireDefault(_classnames); 39 | 40 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 41 | 42 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 43 | 44 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 45 | 46 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 47 | 48 | function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { 49 | var desc = {}; 50 | Object['ke' + 'ys'](descriptor).forEach(function (key) { 51 | desc[key] = descriptor[key]; 52 | }); 53 | desc.enumerable = !!desc.enumerable; 54 | desc.configurable = !!desc.configurable; 55 | 56 | if ('value' in desc || desc.initializer) { 57 | desc.writable = true; 58 | } 59 | 60 | desc = decorators.slice().reverse().reduce(function (desc, decorator) { 61 | return decorator(target, property, desc) || desc; 62 | }, desc); 63 | 64 | if (context && desc.initializer !== void 0) { 65 | desc.value = desc.initializer ? desc.initializer.call(context) : void 0; 66 | desc.initializer = undefined; 67 | } 68 | 69 | if (desc.initializer === void 0) { 70 | Object['define' + 'Property'](target, property, desc); 71 | desc = null; 72 | } 73 | 74 | return desc; 75 | } 76 | 77 | /** 78 | * A react wrapper component for `nipplejs`. 79 | * @see https://www.npmjs.com/package/nipplejs 80 | * @author Jovica Aleksic 81 | */ 82 | var ReactNipple = (_class = function (_Component) { 83 | _inherits(ReactNipple, _Component); 84 | 85 | function ReactNipple() { 86 | _classCallCheck(this, ReactNipple); 87 | 88 | return _possibleConstructorReturn(this, (ReactNipple.__proto__ || Object.getPrototypeOf(ReactNipple)).apply(this, arguments)); 89 | } 90 | 91 | _createClass(ReactNipple, [{ 92 | key: 'componentDidUpdate', 93 | value: function componentDidUpdate(prevProps) { 94 | if (!(0, _lodash2.default)(prevProps.options, this.props.options)) { 95 | this.destroyJoystick(); 96 | this.createJoystick(); 97 | } 98 | } 99 | }, { 100 | key: 'render', 101 | value: function render() { 102 | return _react2.default.createElement('div', _extends({}, this.elementProps, { ref: this.handleElement, className: (0, _classnames2.default)('ReactNipple', this.props.className) })); 103 | } 104 | 105 | //----------------------------------- 106 | // 107 | // impl 108 | // 109 | //----------------------------------- 110 | 111 | }, { 112 | key: 'handleElement', 113 | value: function handleElement(ref) { 114 | this._element = ref; 115 | if (ref) { 116 | this.createJoystick(); 117 | } else if (this._element) { 118 | this.destroyJoystick(); 119 | } 120 | } 121 | }, { 122 | key: 'createJoystick', 123 | value: function createJoystick() { 124 | var options = _extends({ 125 | zone: this._element 126 | }, this.props.options); 127 | 128 | if (this.props.static) { 129 | options.mode = 'static'; 130 | options.position = { 131 | top: '50%', 132 | left: '50%' 133 | }; 134 | } 135 | 136 | var joystick = _nipplejs2.default.create(options); 137 | joystick.on('start', this.handleJoystickStart); 138 | joystick.on('end', this.handleJoystickEnd); 139 | joystick.on('move', this.handleJoystickMove); 140 | joystick.on('dir', this.handleJoystickDir); 141 | joystick.on('plain', this.handleJoystickPlain); 142 | joystick.on('shown', this.handleJoystickShown); 143 | joystick.on('hidden', this.handleJoystickHidden); 144 | joystick.on('pressure', this.handleJoystickPressure); 145 | 146 | this.joystick = joystick; 147 | 148 | if (this.props.onCreated) { 149 | this.props.onCreated(this.joystick); 150 | } 151 | } 152 | }, { 153 | key: 'destroyJoystick', 154 | value: function destroyJoystick() { 155 | if (this.joystick) { 156 | this.joystick.destroy(); 157 | this.joystick = undefined; 158 | } 159 | } 160 | }, { 161 | key: 'invokeCallback', 162 | value: function invokeCallback(type, evt, data) { 163 | if (this.props[type]) { 164 | this.props[type](evt, data); 165 | } 166 | } 167 | }, { 168 | key: 'handleJoystickStart', 169 | value: function handleJoystickStart(evt, data) { 170 | this.invokeCallback('onStart', evt, data); 171 | } 172 | }, { 173 | key: 'handleJoystickEnd', 174 | value: function handleJoystickEnd(evt, data) { 175 | this.invokeCallback('onEnd', evt, data); 176 | } 177 | }, { 178 | key: 'handleJoystickMove', 179 | value: function handleJoystickMove(evt, data) { 180 | this.invokeCallback('onMove', evt, data); 181 | } 182 | }, { 183 | key: 'handleJoystickDir', 184 | value: function handleJoystickDir(evt, data) { 185 | this.invokeCallback('onDir', evt, data); 186 | } 187 | }, { 188 | key: 'handleJoystickPlain', 189 | value: function handleJoystickPlain(evt, data) { 190 | this.invokeCallback('onPlain', evt, data); 191 | } 192 | }, { 193 | key: 'handleJoystickShown', 194 | value: function handleJoystickShown(evt, data) { 195 | this.invokeCallback('onShown', evt, data); 196 | } 197 | }, { 198 | key: 'handleJoystickHidden', 199 | value: function handleJoystickHidden(evt, data) { 200 | this.invokeCallback('onHidden', evt, data); 201 | } 202 | }, { 203 | key: 'handleJoystickPressure', 204 | value: function handleJoystickPressure(evt, data) { 205 | this.invokeCallback('onPressure', evt, data); 206 | } 207 | }, { 208 | key: 'ownProps', 209 | get: function get() { 210 | return ['options', 'static', 'onStart', 'onEnd', 'onMove', 'onDir', 'onPlain', 'onShown', 'onHidden', 'onPressure', 'onCreated']; 211 | } 212 | }, { 213 | key: 'elementProps', 214 | get: function get() { 215 | var _this2 = this; 216 | 217 | return Object.entries(this.props).reduce(function (result, _ref) { 218 | var _ref2 = _slicedToArray(_ref, 2), 219 | key = _ref2[0], 220 | value = _ref2[1]; 221 | 222 | if (_this2.ownProps.includes(key)) { 223 | return result; 224 | } 225 | result[key] = value; 226 | return result; 227 | }, {}); 228 | } 229 | }], [{ 230 | key: 'propTypes', 231 | 232 | /* eslint-disable no-trailing-spaces */ 233 | /** 234 | * Component propTypes 235 | * 236 | * Any additional (unknown) props will be passed along as attributes of the created DOM element. 237 | * 238 | * @property {string} className - A css classname for the DOM element 239 | * @property {object} options - An object with nipplejs options, see https://github.com/yoannmoinet/nipplejs#options 240 | * @property {boolean} static - A shortcut for setting the options `{mode: 'static', position: {top: '50%', left: '50%'}}`. Will override values in the `options` object. 241 | * @property {function} onCreated - Callback that is invoked with the created instance 242 | * @property {function} onDestroy - Callback that is invoked with the instance that is going to be destroyed 243 | * @property {function} onStart - Callback for the 'start' event handler, see https://github.com/yoannmoinet/nipplejs#start 244 | * @property {function} onEnd - Callback for the 'end' event handler, see https://github.com/yoannmoinet/nipplejs#end 245 | * @property {function} onMove - Callback for the 'move' event handler, see https://github.com/yoannmoinet/nipplejs#move 246 | * @property {function} onDir - Callback for the 'dir' event handler, see https://github.com/yoannmoinet/nipplejs#dir 247 | * @property {function} onPlain - Callback for the 'plain' event handler, see https://github.com/yoannmoinet/nipplejs#plain 248 | * @property {function} onShown - Callback for the 'shown' event handler, see https://github.com/yoannmoinet/nipplejs#shown 249 | * @property {function} onHidden - Callback for the 'hidden' event handler, see https://github.com/yoannmoinet/nipplejs#hidden 250 | * @property {function} onPressure - Callback for the 'pressure' event handler, see https://github.com/yoannmoinet/nipplejs#pressure 251 | */ 252 | /* eslint-enable no-trailing-spaces */ 253 | get: function get() { 254 | return { 255 | className: _propTypes2.default.string, 256 | options: _propTypes2.default.shape({ 257 | color: _propTypes2.default.string, 258 | size: _propTypes2.default.integer, 259 | threshold: _propTypes2.default.float, // before triggering a directional event 260 | fadeTime: _propTypes2.default.integer, // transition time 261 | multitouch: _propTypes2.default.bool, 262 | maxNumberOfNipples: _propTypes2.default.number, // when multitouch, what is too many? 263 | dataOnly: _propTypes2.default.bool, // no dom element whatsoever 264 | position: _propTypes2.default.object, // preset position for 'static' mode 265 | mode: _propTypes2.default.string, // 'dynamic', 'static' or 'semi' 266 | restJoystick: _propTypes2.default.bool, 267 | restOpacity: _propTypes2.default.number, // opacity when not 'dynamic' and rested 268 | catchDistance: _propTypes2.default.number, 269 | lockX: _propTypes2.default.bool, 270 | lockY: _propTypes2.default.bool, 271 | shape: _propTypes2.default.string, 272 | dynamicPage: _propTypes2.default.bool 273 | }), 274 | static: _propTypes2.default.bool, 275 | onStart: _propTypes2.default.func, 276 | onEnd: _propTypes2.default.func, 277 | onMove: _propTypes2.default.func, 278 | onDir: _propTypes2.default.func, 279 | onPlain: _propTypes2.default.func, 280 | onShown: _propTypes2.default.func, 281 | onHidden: _propTypes2.default.func, 282 | onPressure: _propTypes2.default.func, 283 | onCreated: _propTypes2.default.func, 284 | onDestroy: _propTypes2.default.func 285 | }; 286 | } 287 | }]); 288 | 289 | return ReactNipple; 290 | }(_react.Component), (_applyDecoratedDescriptor(_class.prototype, 'handleElement', [_autobindDecorator2.default], Object.getOwnPropertyDescriptor(_class.prototype, 'handleElement'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'handleJoystickStart', [_autobindDecorator2.default], Object.getOwnPropertyDescriptor(_class.prototype, 'handleJoystickStart'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'handleJoystickEnd', [_autobindDecorator2.default], Object.getOwnPropertyDescriptor(_class.prototype, 'handleJoystickEnd'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'handleJoystickMove', [_autobindDecorator2.default], Object.getOwnPropertyDescriptor(_class.prototype, 'handleJoystickMove'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'handleJoystickDir', [_autobindDecorator2.default], Object.getOwnPropertyDescriptor(_class.prototype, 'handleJoystickDir'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'handleJoystickPlain', [_autobindDecorator2.default], Object.getOwnPropertyDescriptor(_class.prototype, 'handleJoystickPlain'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'handleJoystickShown', [_autobindDecorator2.default], Object.getOwnPropertyDescriptor(_class.prototype, 'handleJoystickShown'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'handleJoystickHidden', [_autobindDecorator2.default], Object.getOwnPropertyDescriptor(_class.prototype, 'handleJoystickHidden'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'handleJoystickPressure', [_autobindDecorator2.default], Object.getOwnPropertyDescriptor(_class.prototype, 'handleJoystickPressure'), _class.prototype)), _class); 291 | exports.default = ReactNipple; -------------------------------------------------------------------------------- /packages/react-nipple/lib/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _ReactNipple = require('./ReactNipple'); 9 | 10 | var _ReactNipple2 = _interopRequireDefault(_ReactNipple); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | exports.default = _ReactNipple2.default; -------------------------------------------------------------------------------- /packages/react-nipple/lib/styles.css: -------------------------------------------------------------------------------- 1 | .ReactNipple { 2 | position: relative; 3 | } 4 | -------------------------------------------------------------------------------- /packages/react-nipple/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-nipple", 3 | "version": "1.0.3", 4 | "main": "lib/index.js", 5 | "license": "MIT", 6 | "scripts": { 7 | "clean": "rm -rf lib/*", 8 | "eslint": "eslint src", 9 | "docs": "esdoc", 10 | "build": "babel src --out-dir lib --copy-files", 11 | "build:watch": "yarn build --watch", 12 | "build:full": "yarn clean && yarn eslint --fix && yarn docs && yarn build", 13 | "prepublishOnly": "yarn build:full" 14 | }, 15 | "peerDependencies": { 16 | "react": "^16.4.1", 17 | "react-dom": "^16.4.1" 18 | }, 19 | "dependencies": { 20 | "autobind-decorator": "^2.1.0", 21 | "classnames": "^2.2.6", 22 | "lodash.isequal": "^4.5.0", 23 | "nipplejs": "^0.8.7" 24 | }, 25 | "devDependencies": { 26 | "@loopmode/babel6-base": "^0.0.6", 27 | "react": "^16.4.1" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/react-nipple/prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('@loopmode/babel6-base/prettier.config') 3 | }; 4 | -------------------------------------------------------------------------------- /packages/react-nipple/preview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loopmode/react-nipple/1820ee28885947c4c76a20edfa19d94899a0575d/packages/react-nipple/preview.gif -------------------------------------------------------------------------------- /packages/react-nipple/src/DebugView.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | 4 | export default class DebugView extends Component { 5 | static propTypes = { 6 | data: PropTypes.shape({ 7 | position: PropTypes.shape({ 8 | x: PropTypes.number, 9 | y: PropTypes.number 10 | }), 11 | angle: PropTypes.shape({ 12 | radian: PropTypes.number, 13 | degree: PropTypes.number 14 | }), 15 | direction: PropTypes.shape({ 16 | x: PropTypes.number, 17 | y: PropTypes.number, 18 | angle: PropTypes.number 19 | }), 20 | force: PropTypes.number, 21 | pressure: PropTypes.number, 22 | distance: PropTypes.number 23 | }) 24 | }; 25 | render() { 26 | const { position = {}, force, pressure, distance, angle = {}, direction = {} } = this.props.data || {}; 27 | 28 | return ( 29 |
    30 |
      31 |
    • 32 | position : 33 |
        34 |
      • 35 | x : 36 | 37 |
      • 38 |
      • 39 | y : 40 | 41 |
      • 42 |
      43 |
    • 44 |
    • 45 | force : 46 |
    • 47 |
    • 48 | pressure : 49 |
    • 50 |
    • 51 | distance : 52 |
    • 53 |
    • 54 | angle : 55 |
        56 |
      • 57 | radian : 58 | 59 |
      • 60 |
      • 61 | degree : 62 | 63 |
      • 64 |
      65 |
    • 66 |
    • 67 | direction : 68 |
        69 |
      • 70 | x : 71 | 72 |
      • 73 |
      • 74 | y : 75 | 76 |
      • 77 |
      • 78 | angle : 79 | 80 |
      • 81 |
      82 |
    • 83 |
    84 |
    85 |
    86 | ); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /packages/react-nipple/src/ReactNipple.js: -------------------------------------------------------------------------------- 1 | import nipplejs from 'nipplejs'; 2 | import autobind from 'autobind-decorator'; 3 | import isEqual from 'lodash.isequal'; 4 | import PropTypes from 'prop-types'; 5 | import React, { Component } from 'react'; 6 | 7 | import cx from 'classnames'; 8 | 9 | /** 10 | * A react wrapper component for `nipplejs`. 11 | * @see https://www.npmjs.com/package/nipplejs 12 | * @author Jovica Aleksic 13 | */ 14 | export default class ReactNipple extends Component { 15 | /* eslint-disable no-trailing-spaces */ 16 | /** 17 | * Component propTypes 18 | * 19 | * Any additional (unknown) props will be passed along as attributes of the created DOM element. 20 | * 21 | * @property {string} className - A css classname for the DOM element 22 | * @property {object} options - An object with nipplejs options, see https://github.com/yoannmoinet/nipplejs#options 23 | * @property {boolean} static - A shortcut for setting the options `{mode: 'static', position: {top: '50%', left: '50%'}}`. Will override values in the `options` object. 24 | * @property {function} onCreated - Callback that is invoked with the created instance 25 | * @property {function} onDestroy - Callback that is invoked with the instance that is going to be destroyed 26 | * @property {function} onStart - Callback for the 'start' event handler, see https://github.com/yoannmoinet/nipplejs#start 27 | * @property {function} onEnd - Callback for the 'end' event handler, see https://github.com/yoannmoinet/nipplejs#end 28 | * @property {function} onMove - Callback for the 'move' event handler, see https://github.com/yoannmoinet/nipplejs#move 29 | * @property {function} onDir - Callback for the 'dir' event handler, see https://github.com/yoannmoinet/nipplejs#dir 30 | * @property {function} onPlain - Callback for the 'plain' event handler, see https://github.com/yoannmoinet/nipplejs#plain 31 | * @property {function} onShown - Callback for the 'shown' event handler, see https://github.com/yoannmoinet/nipplejs#shown 32 | * @property {function} onHidden - Callback for the 'hidden' event handler, see https://github.com/yoannmoinet/nipplejs#hidden 33 | * @property {function} onPressure - Callback for the 'pressure' event handler, see https://github.com/yoannmoinet/nipplejs#pressure 34 | */ 35 | /* eslint-enable no-trailing-spaces */ 36 | static get propTypes() { 37 | return { 38 | className: PropTypes.string, 39 | options: PropTypes.shape({ 40 | color: PropTypes.string, 41 | size: PropTypes.integer, 42 | threshold: PropTypes.float, // before triggering a directional event 43 | fadeTime: PropTypes.integer, // transition time 44 | multitouch: PropTypes.bool, 45 | maxNumberOfNipples: PropTypes.number, // when multitouch, what is too many? 46 | dataOnly: PropTypes.bool, // no dom element whatsoever 47 | position: PropTypes.object, // preset position for 'static' mode 48 | mode: PropTypes.string, // 'dynamic', 'static' or 'semi' 49 | restJoystick: PropTypes.bool, 50 | restOpacity: PropTypes.number, // opacity when not 'dynamic' and rested 51 | catchDistance: PropTypes.number, 52 | lockX: PropTypes.bool, 53 | lockY: PropTypes.bool, 54 | shape: PropTypes.string, 55 | dynamicPage: PropTypes.bool 56 | }), 57 | static: PropTypes.bool, 58 | onStart: PropTypes.func, 59 | onEnd: PropTypes.func, 60 | onMove: PropTypes.func, 61 | onDir: PropTypes.func, 62 | onPlain: PropTypes.func, 63 | onShown: PropTypes.func, 64 | onHidden: PropTypes.func, 65 | onPressure: PropTypes.func, 66 | onCreated: PropTypes.func, 67 | onDestroy: PropTypes.func 68 | }; 69 | } 70 | 71 | get ownProps() { 72 | return [ 73 | 'options', 74 | 'static', 75 | 'onStart', 76 | 'onEnd', 77 | 'onMove', 78 | 'onDir', 79 | 'onPlain', 80 | 'onShown', 81 | 'onHidden', 82 | 'onPressure', 83 | 'onCreated' 84 | ]; 85 | } 86 | get elementProps() { 87 | return Object.entries(this.props).reduce((result, [key, value]) => { 88 | if (this.ownProps.includes(key)) { 89 | return result; 90 | } 91 | result[key] = value; 92 | return result; 93 | }, {}); 94 | } 95 | 96 | componentDidUpdate(prevProps) { 97 | if (!isEqual(prevProps.options, this.props.options)) { 98 | this.destroyJoystick(); 99 | this.createJoystick(); 100 | } 101 | } 102 | 103 | render() { 104 | return ( 105 |
    106 | ); 107 | } 108 | 109 | //----------------------------------- 110 | // 111 | // impl 112 | // 113 | //----------------------------------- 114 | 115 | @autobind 116 | handleElement(ref) { 117 | this._element = ref; 118 | if (ref) { 119 | this.createJoystick(); 120 | } else if (this._element) { 121 | this.destroyJoystick(); 122 | } 123 | } 124 | createJoystick() { 125 | const options = { 126 | zone: this._element, 127 | ...this.props.options 128 | }; 129 | 130 | if (this.props.static) { 131 | options.mode = 'static'; 132 | options.position = { 133 | top: '50%', 134 | left: '50%' 135 | }; 136 | } 137 | 138 | const joystick = nipplejs.create(options); 139 | joystick.on('start', this.handleJoystickStart); 140 | joystick.on('end', this.handleJoystickEnd); 141 | joystick.on('move', this.handleJoystickMove); 142 | joystick.on('dir', this.handleJoystickDir); 143 | joystick.on('plain', this.handleJoystickPlain); 144 | joystick.on('shown', this.handleJoystickShown); 145 | joystick.on('hidden', this.handleJoystickHidden); 146 | joystick.on('pressure', this.handleJoystickPressure); 147 | 148 | this.joystick = joystick; 149 | 150 | if (this.props.onCreated) { 151 | this.props.onCreated(this.joystick); 152 | } 153 | } 154 | destroyJoystick() { 155 | if (this.joystick) { 156 | this.joystick.destroy(); 157 | this.joystick = undefined; 158 | } 159 | } 160 | invokeCallback(type, evt, data) { 161 | if (this.props[type]) { 162 | this.props[type](evt, data); 163 | } 164 | } 165 | @autobind 166 | handleJoystickStart(evt, data) { 167 | this.invokeCallback('onStart', evt, data); 168 | } 169 | @autobind 170 | handleJoystickEnd(evt, data) { 171 | this.invokeCallback('onEnd', evt, data); 172 | } 173 | @autobind 174 | handleJoystickMove(evt, data) { 175 | this.invokeCallback('onMove', evt, data); 176 | } 177 | @autobind 178 | handleJoystickDir(evt, data) { 179 | this.invokeCallback('onDir', evt, data); 180 | } 181 | @autobind 182 | handleJoystickPlain(evt, data) { 183 | this.invokeCallback('onPlain', evt, data); 184 | } 185 | @autobind 186 | handleJoystickShown(evt, data) { 187 | this.invokeCallback('onShown', evt, data); 188 | } 189 | @autobind 190 | handleJoystickHidden(evt, data) { 191 | this.invokeCallback('onHidden', evt, data); 192 | } 193 | @autobind 194 | handleJoystickPressure(evt, data) { 195 | this.invokeCallback('onPressure', evt, data); 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /packages/react-nipple/src/index.js: -------------------------------------------------------------------------------- 1 | export default from './ReactNipple'; 2 | -------------------------------------------------------------------------------- /packages/react-nipple/src/styles.css: -------------------------------------------------------------------------------- 1 | .ReactNipple { 2 | position: relative; 3 | } 4 | -------------------------------------------------------------------------------- /packages/react-nipple/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | asap@~2.0.3: 6 | version "2.0.6" 7 | resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" 8 | 9 | core-js@^1.0.0: 10 | version "1.2.7" 11 | resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" 12 | 13 | encoding@^0.1.11: 14 | version "0.1.12" 15 | resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" 16 | dependencies: 17 | iconv-lite "~0.4.13" 18 | 19 | fbjs@^0.8.16: 20 | version "0.8.17" 21 | resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" 22 | dependencies: 23 | core-js "^1.0.0" 24 | isomorphic-fetch "^2.1.1" 25 | loose-envify "^1.0.0" 26 | object-assign "^4.1.0" 27 | promise "^7.1.1" 28 | setimmediate "^1.0.5" 29 | ua-parser-js "^0.7.18" 30 | 31 | iconv-lite@~0.4.13: 32 | version "0.4.23" 33 | resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" 34 | dependencies: 35 | safer-buffer ">= 2.1.2 < 3" 36 | 37 | is-stream@^1.0.1: 38 | version "1.1.0" 39 | resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" 40 | 41 | isomorphic-fetch@^2.1.1: 42 | version "2.2.1" 43 | resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" 44 | dependencies: 45 | node-fetch "^1.0.1" 46 | whatwg-fetch ">=0.10.0" 47 | 48 | "js-tokens@^3.0.0 || ^4.0.0": 49 | version "4.0.0" 50 | resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" 51 | 52 | loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1: 53 | version "1.4.0" 54 | resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" 55 | dependencies: 56 | js-tokens "^3.0.0 || ^4.0.0" 57 | 58 | nipplejs@^0.7.1: 59 | version "0.7.1" 60 | resolved "https://registry.yarnpkg.com/nipplejs/-/nipplejs-0.7.1.tgz#43de3f154a9d5c662acd91d13b347369b1bc88bc" 61 | 62 | node-fetch@^1.0.1: 63 | version "1.7.3" 64 | resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" 65 | dependencies: 66 | encoding "^0.1.11" 67 | is-stream "^1.0.1" 68 | 69 | object-assign@^4.1.0, object-assign@^4.1.1: 70 | version "4.1.1" 71 | resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" 72 | 73 | promise@^7.1.1: 74 | version "7.3.1" 75 | resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" 76 | dependencies: 77 | asap "~2.0.3" 78 | 79 | prop-types@^15.6.0, prop-types@^15.6.2: 80 | version "15.6.2" 81 | resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102" 82 | dependencies: 83 | loose-envify "^1.3.1" 84 | object-assign "^4.1.1" 85 | 86 | react@^16.4.1: 87 | version "16.4.1" 88 | resolved "https://registry.yarnpkg.com/react/-/react-16.4.1.tgz#de51ba5764b5dbcd1f9079037b862bd26b82fe32" 89 | dependencies: 90 | fbjs "^0.8.16" 91 | loose-envify "^1.1.0" 92 | object-assign "^4.1.1" 93 | prop-types "^15.6.0" 94 | 95 | "safer-buffer@>= 2.1.2 < 3": 96 | version "2.1.2" 97 | resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" 98 | 99 | setimmediate@^1.0.5: 100 | version "1.0.5" 101 | resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" 102 | 103 | ua-parser-js@^0.7.18: 104 | version "0.7.18" 105 | resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.18.tgz#a7bfd92f56edfb117083b69e31d2aa8882d4b1ed" 106 | 107 | whatwg-fetch@>=0.10.0: 108 | version "2.0.4" 109 | resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" 110 | -------------------------------------------------------------------------------- /workspace.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "path": ".", 6 | "folder_exclude_patterns": [ 7 | "build", 8 | // "lib", 9 | "node_modules", 10 | ] 11 | } 12 | ], 13 | "settings": 14 | { 15 | "SublimeLinter.linters.eslint.chdir": "${project}/", 16 | "js_prettier": 17 | { 18 | "auto_format_on_save": true, 19 | "auto_format_on_save_excludes": ["*/node_modules/*", "*/.git/*", "*.json", "*.html"] 20 | } 21 | } 22 | } 23 | --------------------------------------------------------------------------------