113 | ) : null}
114 |
115 |
121 |
122 | )
123 | }
124 | }
125 |
126 | export default Story
127 |
--------------------------------------------------------------------------------
/modules/button-layer/src/stories/PointCluster.story.src.js:
--------------------------------------------------------------------------------
1 | /**
2 | * ButtonLayer - Point Clustering
3 | *
4 | * ## ButtonLayer Example - Point Clustering
5 | *
6 | * Uses the ButtonLayer 'meta component' to add points with clustering.
7 | */
8 | import React from 'react'
9 | import {mapDefaults} from '@react-mapboxgl/docs'
10 | import {MapGL} from '@react-mapboxgl/core'
11 | import ButtonLayer from '../'
12 |
13 | class Story extends React.Component {
14 | render () {
15 | return (
16 |
17 |
72 |
73 | )
74 | }
75 | }
76 |
77 | export default Story
78 |
--------------------------------------------------------------------------------
/modules/button-layer/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | "@react-mapboxgl/click@^2.1.2":
6 | version "2.1.2"
7 | resolved "https://registry.npmjs.org/@react-mapboxgl/click/-/click-2.1.2.tgz#05d338575f8be530efddd2a9b0f8f88be57e598e"
8 | dependencies:
9 | "@react-mapboxgl/core" "^2.1.1"
10 | "@react-mapboxgl/docs" "^2.1.0"
11 |
12 | "@react-mapboxgl/core@^2.1.1":
13 | version "2.1.1"
14 | resolved "https://registry.npmjs.org/@react-mapboxgl/core/-/core-2.1.1.tgz#e337dc29c2c4f6e78284ba9994cde4a41e2cd929"
15 | dependencies:
16 | "@react-mapboxgl/docs" "^2.1.0"
17 |
18 | "@react-mapboxgl/docs@^2.1.0":
19 | version "2.1.0"
20 | resolved "https://registry.npmjs.org/@react-mapboxgl/docs/-/docs-2.1.0.tgz#b4c81a6a49ed6ca9c6f9328f35a86d309797060f"
21 |
22 | "@react-mapboxgl/hover@^2.1.1":
23 | version "2.1.1"
24 | resolved "https://registry.npmjs.org/@react-mapboxgl/hover/-/hover-2.1.1.tgz#cb13449e39f84d3311f58a0392b36ccca9e4cc66"
25 | dependencies:
26 | "@react-mapboxgl/core" "^2.1.1"
27 | "@react-mapboxgl/docs" "^2.1.0"
28 | "@terraeclipse/throttle-raf-decorator" "^1.0.4"
29 |
30 | "@react-mapboxgl/toggle@^2.1.2":
31 | version "2.1.2"
32 | resolved "https://registry.npmjs.org/@react-mapboxgl/toggle/-/toggle-2.1.2.tgz#b4ca4313464aa1b9103577b7ef329222689665c9"
33 | dependencies:
34 | "@react-mapboxgl/click" "^2.1.2"
35 | "@react-mapboxgl/core" "^2.1.1"
36 | "@react-mapboxgl/docs" "^2.1.0"
37 |
38 | "@terraeclipse/throttle-raf-decorator@^1.0.4":
39 | version "1.0.4"
40 | resolved "https://registry.npmjs.org/@terraeclipse/throttle-raf-decorator/-/throttle-raf-decorator-1.0.4.tgz#c23c37c20f5a433904d2284e1224fe51fde3f653"
41 | dependencies:
42 | raf "^3.3.2"
43 |
44 | "@turf/bbox@^4.3.0":
45 | version "4.4.0"
46 | resolved "https://registry.npmjs.org/@turf/bbox/-/bbox-4.4.0.tgz#3149458eb41404427cf786a90fb3680a0e8aab55"
47 | dependencies:
48 | "@turf/meta" "^4.4.0"
49 |
50 | "@turf/meta@^4.4.0":
51 | version "4.4.0"
52 | resolved "https://registry.npmjs.org/@turf/meta/-/meta-4.4.0.tgz#4fa25d4cc0525bd4cdbaf4ff68a6f8ae81f1975f"
53 |
54 | "@turf/union@^4.4.0":
55 | version "4.4.0"
56 | resolved "https://registry.npmjs.org/@turf/union/-/union-4.4.0.tgz#cad6e957c5ef843f64b061d595b9e884b12cf710"
57 | dependencies:
58 | jsts "1.3.0"
59 |
60 | asap@~2.0.3:
61 | version "2.0.5"
62 | resolved "https://registry.npmjs.org/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f"
63 |
64 | core-js@^1.0.0:
65 | version "1.2.7"
66 | resolved "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
67 |
68 | encoding@^0.1.11:
69 | version "0.1.12"
70 | resolved "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
71 | dependencies:
72 | iconv-lite "~0.4.13"
73 |
74 | fbjs@^0.8.9:
75 | version "0.8.12"
76 | resolved "https://registry.npmjs.org/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04"
77 | dependencies:
78 | core-js "^1.0.0"
79 | isomorphic-fetch "^2.1.1"
80 | loose-envify "^1.0.0"
81 | object-assign "^4.1.0"
82 | promise "^7.1.1"
83 | setimmediate "^1.0.5"
84 | ua-parser-js "^0.7.9"
85 |
86 | iconv-lite@~0.4.13:
87 | version "0.4.17"
88 | resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.17.tgz#4fdaa3b38acbc2c031b045d0edcdfe1ecab18c8d"
89 |
90 | is-stream@^1.0.1:
91 | version "1.1.0"
92 | resolved "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
93 |
94 | isomorphic-fetch@^2.1.1:
95 | version "2.2.1"
96 | resolved "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
97 | dependencies:
98 | node-fetch "^1.0.1"
99 | whatwg-fetch ">=0.10.0"
100 |
101 | js-tokens@^3.0.0:
102 | version "3.0.1"
103 | resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7"
104 |
105 | jsts@1.3.0:
106 | version "1.3.0"
107 | resolved "https://registry.npmjs.org/jsts/-/jsts-1.3.0.tgz#e93a76f97ac9bda7d4625d9d6470f0d60ac80e45"
108 |
109 | lodash@^4.17.4:
110 | version "4.17.4"
111 | resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
112 |
113 | loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1:
114 | version "1.3.1"
115 | resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
116 | dependencies:
117 | js-tokens "^3.0.0"
118 |
119 | node-fetch@^1.0.1:
120 | version "1.7.1"
121 | resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.1.tgz#899cb3d0a3c92f952c47f1b876f4c8aeabd400d5"
122 | dependencies:
123 | encoding "^0.1.11"
124 | is-stream "^1.0.1"
125 |
126 | object-assign@^4.1.0:
127 | version "4.1.1"
128 | resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
129 |
130 | performance-now@^2.1.0:
131 | version "2.1.0"
132 | resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
133 |
134 | promise@^7.1.1:
135 | version "7.1.1"
136 | resolved "https://registry.npmjs.org/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf"
137 | dependencies:
138 | asap "~2.0.3"
139 |
140 | prop-types@^15.5.10, prop-types@^15.5.7:
141 | version "15.5.10"
142 | resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
143 | dependencies:
144 | fbjs "^0.8.9"
145 | loose-envify "^1.3.1"
146 |
147 | raf@^3.3.2:
148 | version "3.3.2"
149 | resolved "https://registry.npmjs.org/raf/-/raf-3.3.2.tgz#0c13be0b5b49b46f76d6669248d527cf2b02fe27"
150 | dependencies:
151 | performance-now "^2.1.0"
152 |
153 | react@^15.5.4:
154 | version "15.5.4"
155 | resolved "https://registry.npmjs.org/react/-/react-15.5.4.tgz#fa83eb01506ab237cdc1c8c3b1cea8de012bf047"
156 | dependencies:
157 | fbjs "^0.8.9"
158 | loose-envify "^1.1.0"
159 | object-assign "^4.1.0"
160 | prop-types "^15.5.7"
161 |
162 | setimmediate@^1.0.5:
163 | version "1.0.5"
164 | resolved "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
165 |
166 | ua-parser-js@^0.7.9:
167 | version "0.7.12"
168 | resolved "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb"
169 |
170 | whatwg-fetch@>=0.10.0:
171 | version "2.0.3"
172 | resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"
173 |
--------------------------------------------------------------------------------
/modules/click/.gitignore:
--------------------------------------------------------------------------------
1 | /coverage
2 | /es
3 | /lib
4 | /node_modules
5 | npm-debug.log
6 |
--------------------------------------------------------------------------------
/modules/click/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2017 Terra Eclipse, Inc.
2 | http://www.terraeclipse.com/
3 |
4 | Copyright 2017 Brian Link
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 |
18 |
19 | -------------------------------------------------------------------------
20 | Apache License
21 | Version 2.0, January 2004
22 | http://www.apache.org/licenses/
23 |
24 |
25 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
26 |
27 | 1. Definitions.
28 |
29 | "License" shall mean the terms and conditions for use, reproduction,
30 | and distribution as defined by Sections 1 through 9 of this document.
31 |
32 | "Licensor" shall mean the copyright owner or entity authorized by
33 | the copyright owner that is granting the License.
34 |
35 | "Legal Entity" shall mean the union of the acting entity and all
36 | other entities that control, are controlled by, or are under common
37 | control with that entity. For the purposes of this definition,
38 | "control" means (i) the power, direct or indirect, to cause the
39 | direction or management of such entity, whether by contract or
40 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
41 | outstanding shares, or (iii) beneficial ownership of such entity.
42 |
43 | "You" (or "Your") shall mean an individual or Legal Entity
44 | exercising permissions granted by this License.
45 |
46 | "Source" form shall mean the preferred form for making modifications,
47 | including but not limited to software source code, documentation
48 | source, and configuration files.
49 |
50 | "Object" form shall mean any form resulting from mechanical
51 | transformation or translation of a Source form, including but
52 | not limited to compiled object code, generated documentation,
53 | and conversions to other media types.
54 |
55 | "Work" shall mean the work of authorship, whether in Source or
56 | Object form, made available under the License, as indicated by a
57 | copyright notice that is included in or attached to the work
58 | (an example is provided in the Appendix below).
59 |
60 | "Derivative Works" shall mean any work, whether in Source or Object
61 | form, that is based on (or derived from) the Work and for which the
62 | editorial revisions, annotations, elaborations, or other modifications
63 | represent, as a whole, an original work of authorship. For the purposes
64 | of this License, Derivative Works shall not include works that remain
65 | separable from, or merely link (or bind by name) to the interfaces of,
66 | the Work and Derivative Works thereof.
67 |
68 | "Contribution" shall mean any work of authorship, including
69 | the original version of the Work and any modifications or additions
70 | to that Work or Derivative Works thereof, that is intentionally
71 | submitted to Licensor for inclusion in the Work by the copyright owner
72 | or by an individual or Legal Entity authorized to submit on behalf of
73 | the copyright owner. For the purposes of this definition, "submitted"
74 | means any form of electronic, verbal, or written communication sent
75 | to the Licensor or its representatives, including but not limited to
76 | communication on electronic mailing lists, source code control systems,
77 | and issue tracking systems that are managed by, or on behalf of, the
78 | Licensor for the purpose of discussing and improving the Work, but
79 | excluding communication that is conspicuously marked or otherwise
80 | designated in writing by the copyright owner as "Not a Contribution."
81 |
82 | "Contributor" shall mean Licensor and any individual or Legal Entity
83 | on behalf of whom a Contribution has been received by Licensor and
84 | subsequently incorporated within the Work.
85 |
86 | 2. Grant of Copyright License. Subject to the terms and conditions of
87 | this License, each Contributor hereby grants to You a perpetual,
88 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
89 | copyright license to reproduce, prepare Derivative Works of,
90 | publicly display, publicly perform, sublicense, and distribute the
91 | Work and such Derivative Works in Source or Object form.
92 |
93 | 3. Grant of Patent License. Subject to the terms and conditions of
94 | this License, each Contributor hereby grants to You a perpetual,
95 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
96 | (except as stated in this section) patent license to make, have made,
97 | use, offer to sell, sell, import, and otherwise transfer the Work,
98 | where such license applies only to those patent claims licensable
99 | by such Contributor that are necessarily infringed by their
100 | Contribution(s) alone or by combination of their Contribution(s)
101 | with the Work to which such Contribution(s) was submitted. If You
102 | institute patent litigation against any entity (including a
103 | cross-claim or counterclaim in a lawsuit) alleging that the Work
104 | or a Contribution incorporated within the Work constitutes direct
105 | or contributory patent infringement, then any patent licenses
106 | granted to You under this License for that Work shall terminate
107 | as of the date such litigation is filed.
108 |
109 | 4. Redistribution. You may reproduce and distribute copies of the
110 | Work or Derivative Works thereof in any medium, with or without
111 | modifications, and in Source or Object form, provided that You
112 | meet the following conditions:
113 |
114 | (a) You must give any other recipients of the Work or
115 | Derivative Works a copy of this License; and
116 |
117 | (b) You must cause any modified files to carry prominent notices
118 | stating that You changed the files; and
119 |
120 | (c) You must retain, in the Source form of any Derivative Works
121 | that You distribute, all copyright, patent, trademark, and
122 | attribution notices from the Source form of the Work,
123 | excluding those notices that do not pertain to any part of
124 | the Derivative Works; and
125 |
126 | (d) If the Work includes a "NOTICE" text file as part of its
127 | distribution, then any Derivative Works that You distribute must
128 | include a readable copy of the attribution notices contained
129 | within such NOTICE file, excluding those notices that do not
130 | pertain to any part of the Derivative Works, in at least one
131 | of the following places: within a NOTICE text file distributed
132 | as part of the Derivative Works; within the Source form or
133 | documentation, if provided along with the Derivative Works; or,
134 | within a display generated by the Derivative Works, if and
135 | wherever such third-party notices normally appear. The contents
136 | of the NOTICE file are for informational purposes only and
137 | do not modify the License. You may add Your own attribution
138 | notices within Derivative Works that You distribute, alongside
139 | or as an addendum to the NOTICE text from the Work, provided
140 | that such additional attribution notices cannot be construed
141 | as modifying the License.
142 |
143 | You may add Your own copyright statement to Your modifications and
144 | may provide additional or different license terms and conditions
145 | for use, reproduction, or distribution of Your modifications, or
146 | for any such Derivative Works as a whole, provided Your use,
147 | reproduction, and distribution of the Work otherwise complies with
148 | the conditions stated in this License.
149 |
150 | 5. Submission of Contributions. Unless You explicitly state otherwise,
151 | any Contribution intentionally submitted for inclusion in the Work
152 | by You to the Licensor shall be under the terms and conditions of
153 | this License, without any additional terms or conditions.
154 | Notwithstanding the above, nothing herein shall supersede or modify
155 | the terms of any separate license agreement you may have executed
156 | with Licensor regarding such Contributions.
157 |
158 | 6. Trademarks. This License does not grant permission to use the trade
159 | names, trademarks, service marks, or product names of the Licensor,
160 | except as required for reasonable and customary use in describing the
161 | origin of the Work and reproducing the content of the NOTICE file.
162 |
163 | 7. Disclaimer of Warranty. Unless required by applicable law or
164 | agreed to in writing, Licensor provides the Work (and each
165 | Contributor provides its Contributions) on an "AS IS" BASIS,
166 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
167 | implied, including, without limitation, any warranties or conditions
168 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
169 | PARTICULAR PURPOSE. You are solely responsible for determining the
170 | appropriateness of using or redistributing the Work and assume any
171 | risks associated with Your exercise of permissions under this License.
172 |
173 | 8. Limitation of Liability. In no event and under no legal theory,
174 | whether in tort (including negligence), contract, or otherwise,
175 | unless required by applicable law (such as deliberate and grossly
176 | negligent acts) or agreed to in writing, shall any Contributor be
177 | liable to You for damages, including any direct, indirect, special,
178 | incidental, or consequential damages of any character arising as a
179 | result of this License or out of the use or inability to use the
180 | Work (including but not limited to damages for loss of goodwill,
181 | work stoppage, computer failure or malfunction, or any and all
182 | other commercial damages or losses), even if such Contributor
183 | has been advised of the possibility of such damages.
184 |
185 | 9. Accepting Warranty or Additional Liability. While redistributing
186 | the Work or Derivative Works thereof, You may choose to offer,
187 | and charge a fee for, acceptance of support, warranty, indemnity,
188 | or other liability obligations and/or rights consistent with this
189 | License. However, in accepting such obligations, You may act only
190 | on Your own behalf and on Your sole responsibility, not on behalf
191 | of any other Contributor, and only if You agree to indemnify,
192 | defend, and hold each Contributor harmless for any liability
193 | incurred by, or claims asserted against, such Contributor by reason
194 | of your accepting any such warranty or additional liability.
195 |
196 | END OF TERMS AND CONDITIONS
--------------------------------------------------------------------------------
/modules/click/README.md:
--------------------------------------------------------------------------------
1 | @react-mapboxgl/click
2 | ======================
3 |
4 | The `Click` component provides some convenience around the `MapEvent` or `LayerEvent`
5 | for click handling. It optionally avoids double clicks (for when you want
6 | to use double click for map zooming).
7 |
8 | Usage
9 | -----
10 |
11 | For an example usage, [see the storybook](https://terraeclipse.github.io/react-mapboxgl/?selectedKind=Click&selectedStory=Example).
12 |
13 | - - -
14 |
15 | #### Developed by [TerraEclipse](https://github.com/TerraEclipse)
16 |
17 | Terra Eclipse, Inc. is a nationally recognized political technology and
18 | strategy firm located in Santa Cruz, CA and Washington, D.C.
19 |
--------------------------------------------------------------------------------
/modules/click/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@react-mapboxgl/click",
3 | "version": "2.1.4",
4 | "publishConfig": {
5 | "access": "public"
6 | },
7 | "description": "Toggle component for @react-mapboxgl",
8 | "standard": {
9 | "parser": "babel-eslint"
10 | },
11 | "main": "lib/index.js",
12 | "module": "es/index.js",
13 | "files": [
14 | "es",
15 | "lib"
16 | ],
17 | "scripts": {
18 | "prepublish": "yarn run build",
19 | "build": "../../tools/build-module",
20 | "clean": "../../tools/clean-module",
21 | "test": "../../tools/test-module",
22 | "coverage": "../../tools/test-module --coverage"
23 | },
24 | "dependencies": {
25 | "@react-mapboxgl/core": "^2.1.3",
26 | "@react-mapboxgl/docs": "^2.1.0"
27 | },
28 | "peerDependencies": {
29 | "prop-types": "^15.5.10",
30 | "react": "^15.5.4"
31 | },
32 | "devDependencies": {
33 | "lodash": "^4.17.4",
34 | "prop-types": "^15.5.10",
35 | "react": "^15.5.4"
36 | },
37 | "author": "Brian Link",
38 | "license": "Apache-2.0",
39 | "repository": {
40 | "type": "git",
41 | "url": "git+https://github.com/TerraEclipse/react-mapboxgl.git"
42 | },
43 | "bugs": {
44 | "url": "https://github.com/TerraEclipse/react-mapboxgl/issues"
45 | },
46 | "homepage": "https://github.com/TerraEclipse/react-mapboxgl/tree/master/modules/click#readme",
47 | "keywords": [
48 | "react-component"
49 | ]
50 | }
51 |
--------------------------------------------------------------------------------
/modules/click/src/Click.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import {Children, MapEvent, LayerEvent} from '@react-mapboxgl/core'
4 |
5 | class Click extends React.Component {
6 | static propTypes = {
7 | layer: PropTypes.string,
8 | clickEvent: PropTypes.string,
9 | avoidDoubleClick: PropTypes.bool,
10 | doubleClickSpeed: PropTypes.number,
11 | onClick: PropTypes.func,
12 | children: PropTypes.func
13 | }
14 |
15 | static defaultProps = {
16 | clickEvent: 'click',
17 | avoidDoubleClick: false,
18 | doubleClickSpeed: 300
19 | }
20 |
21 | static contextTypes = {
22 | map: PropTypes.object
23 | }
24 |
25 | constructor () {
26 | super()
27 | this.handleClick = this.handleClick.bind(this)
28 | this.handleDoubleClick = this.handleDoubleClick.bind(this)
29 | }
30 |
31 | handleClick (e) {
32 | if (this.props.onClick) {
33 | if (this.props.avoidDoubleClick) {
34 | clearTimeout(this._doubleClickTimeout)
35 | this._doubleClickTimeout = setTimeout(() => {
36 | this.props.onClick(e, e.features)
37 | }, this.props.doubleClickSpeed)
38 | } else {
39 | this.props.onClick(e, e.features)
40 | }
41 | }
42 | }
43 |
44 | handleDoubleClick (e) {
45 | clearTimeout(this._doubleClickTimeout)
46 | }
47 |
48 | render () {
49 | let {clickEvent, layer, avoidDoubleClick} = this.props
50 | return (
51 |
52 | {layer ? (
53 |
54 | ) : (
55 |
56 | )}
57 | {avoidDoubleClick ? (
58 |
59 | ) : null}
60 | {this.props.children}
61 |
62 | )
63 | }
64 | }
65 |
66 | export default Click
67 |
--------------------------------------------------------------------------------
/modules/click/src/Click.story.src.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Click - Example
3 | *
4 | * ## Click Features in a Layer
5 | *
6 | * Adds a click handler for features in a Layer. `` provides some helpful
7 | * functionality around `` and `` for optionally avoiding
8 | * double-click events (useful when you want to use double-click for zooming).
9 | */
10 | import React from 'react'
11 | import {action} from '@storybook/addon-actions'
12 | import {mapDefaults} from '@react-mapboxgl/docs'
13 | import {MapGL, Source, Layer} from '@react-mapboxgl/core'
14 | import Click from './'
15 |
16 | class Story extends React.Component {
17 | state = {
18 | multiple: false
19 | }
20 |
21 | constructor () {
22 | super()
23 | this.handleClick = this.handleClick.bind(this)
24 | }
25 |
26 | handleClick (e, features) {
27 | console.log(e)
28 | action('click')(features)
29 | }
30 |
31 | render () {
32 | return (
33 |
34 |
39 |
48 |
57 |
62 |
63 | )
64 | }
65 | }
66 |
67 | export default Story
68 |
--------------------------------------------------------------------------------
/modules/click/src/index.js:
--------------------------------------------------------------------------------
1 | import Click from './Click'
2 | export default Click
3 |
--------------------------------------------------------------------------------
/modules/click/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | "@react-mapboxgl/core@^2.0.3":
6 | version "2.0.3"
7 | resolved "https://registry.npmjs.org/@react-mapboxgl/core/-/core-2.0.3.tgz#f76c3c4d83c3da29a528bfe393bb9482ade76b46"
8 | dependencies:
9 | "@react-mapboxgl/docs" "^2.0.0"
10 |
11 | "@react-mapboxgl/docs@^2.0.0":
12 | version "2.0.0"
13 | resolved "https://registry.npmjs.org/@react-mapboxgl/docs/-/docs-2.0.0.tgz#c4110f34f423a05e55cc7cb8e0646dc44a1be2c5"
14 |
15 | asap@~2.0.3:
16 | version "2.0.5"
17 | resolved "https://registry.npmjs.org/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f"
18 |
19 | core-js@^1.0.0:
20 | version "1.2.7"
21 | resolved "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
22 |
23 | encoding@^0.1.11:
24 | version "0.1.12"
25 | resolved "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
26 | dependencies:
27 | iconv-lite "~0.4.13"
28 |
29 | fbjs@^0.8.9:
30 | version "0.8.12"
31 | resolved "https://registry.npmjs.org/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04"
32 | dependencies:
33 | core-js "^1.0.0"
34 | isomorphic-fetch "^2.1.1"
35 | loose-envify "^1.0.0"
36 | object-assign "^4.1.0"
37 | promise "^7.1.1"
38 | setimmediate "^1.0.5"
39 | ua-parser-js "^0.7.9"
40 |
41 | iconv-lite@~0.4.13:
42 | version "0.4.17"
43 | resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.17.tgz#4fdaa3b38acbc2c031b045d0edcdfe1ecab18c8d"
44 |
45 | is-stream@^1.0.1:
46 | version "1.1.0"
47 | resolved "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
48 |
49 | isomorphic-fetch@^2.1.1:
50 | version "2.2.1"
51 | resolved "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
52 | dependencies:
53 | node-fetch "^1.0.1"
54 | whatwg-fetch ">=0.10.0"
55 |
56 | js-tokens@^3.0.0:
57 | version "3.0.1"
58 | resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7"
59 |
60 | lodash@^4.17.4:
61 | version "4.17.4"
62 | resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
63 |
64 | loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1:
65 | version "1.3.1"
66 | resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
67 | dependencies:
68 | js-tokens "^3.0.0"
69 |
70 | node-fetch@^1.0.1:
71 | version "1.7.1"
72 | resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.1.tgz#899cb3d0a3c92f952c47f1b876f4c8aeabd400d5"
73 | dependencies:
74 | encoding "^0.1.11"
75 | is-stream "^1.0.1"
76 |
77 | object-assign@^4.1.0:
78 | version "4.1.1"
79 | resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
80 |
81 | promise@^7.1.1:
82 | version "7.1.1"
83 | resolved "https://registry.npmjs.org/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf"
84 | dependencies:
85 | asap "~2.0.3"
86 |
87 | prop-types@^15.5.10, prop-types@^15.5.7:
88 | version "15.5.10"
89 | resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
90 | dependencies:
91 | fbjs "^0.8.9"
92 | loose-envify "^1.3.1"
93 |
94 | react@^15.5.4:
95 | version "15.5.4"
96 | resolved "https://registry.npmjs.org/react/-/react-15.5.4.tgz#fa83eb01506ab237cdc1c8c3b1cea8de012bf047"
97 | dependencies:
98 | fbjs "^0.8.9"
99 | loose-envify "^1.1.0"
100 | object-assign "^4.1.0"
101 | prop-types "^15.5.7"
102 |
103 | setimmediate@^1.0.5:
104 | version "1.0.5"
105 | resolved "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
106 |
107 | ua-parser-js@^0.7.9:
108 | version "0.7.12"
109 | resolved "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb"
110 |
111 | whatwg-fetch@>=0.10.0:
112 | version "2.0.3"
113 | resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"
114 |
--------------------------------------------------------------------------------
/modules/core/.gitignore:
--------------------------------------------------------------------------------
1 | /coverage
2 | /es
3 | /lib
4 | /node_modules
5 | npm-debug.log
6 |
--------------------------------------------------------------------------------
/modules/core/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2017 Terra Eclipse, Inc.
2 | http://www.terraeclipse.com/
3 |
4 | Copyright 2017 Brian Link
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 |
18 |
19 | -------------------------------------------------------------------------
20 | Apache License
21 | Version 2.0, January 2004
22 | http://www.apache.org/licenses/
23 |
24 |
25 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
26 |
27 | 1. Definitions.
28 |
29 | "License" shall mean the terms and conditions for use, reproduction,
30 | and distribution as defined by Sections 1 through 9 of this document.
31 |
32 | "Licensor" shall mean the copyright owner or entity authorized by
33 | the copyright owner that is granting the License.
34 |
35 | "Legal Entity" shall mean the union of the acting entity and all
36 | other entities that control, are controlled by, or are under common
37 | control with that entity. For the purposes of this definition,
38 | "control" means (i) the power, direct or indirect, to cause the
39 | direction or management of such entity, whether by contract or
40 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
41 | outstanding shares, or (iii) beneficial ownership of such entity.
42 |
43 | "You" (or "Your") shall mean an individual or Legal Entity
44 | exercising permissions granted by this License.
45 |
46 | "Source" form shall mean the preferred form for making modifications,
47 | including but not limited to software source code, documentation
48 | source, and configuration files.
49 |
50 | "Object" form shall mean any form resulting from mechanical
51 | transformation or translation of a Source form, including but
52 | not limited to compiled object code, generated documentation,
53 | and conversions to other media types.
54 |
55 | "Work" shall mean the work of authorship, whether in Source or
56 | Object form, made available under the License, as indicated by a
57 | copyright notice that is included in or attached to the work
58 | (an example is provided in the Appendix below).
59 |
60 | "Derivative Works" shall mean any work, whether in Source or Object
61 | form, that is based on (or derived from) the Work and for which the
62 | editorial revisions, annotations, elaborations, or other modifications
63 | represent, as a whole, an original work of authorship. For the purposes
64 | of this License, Derivative Works shall not include works that remain
65 | separable from, or merely link (or bind by name) to the interfaces of,
66 | the Work and Derivative Works thereof.
67 |
68 | "Contribution" shall mean any work of authorship, including
69 | the original version of the Work and any modifications or additions
70 | to that Work or Derivative Works thereof, that is intentionally
71 | submitted to Licensor for inclusion in the Work by the copyright owner
72 | or by an individual or Legal Entity authorized to submit on behalf of
73 | the copyright owner. For the purposes of this definition, "submitted"
74 | means any form of electronic, verbal, or written communication sent
75 | to the Licensor or its representatives, including but not limited to
76 | communication on electronic mailing lists, source code control systems,
77 | and issue tracking systems that are managed by, or on behalf of, the
78 | Licensor for the purpose of discussing and improving the Work, but
79 | excluding communication that is conspicuously marked or otherwise
80 | designated in writing by the copyright owner as "Not a Contribution."
81 |
82 | "Contributor" shall mean Licensor and any individual or Legal Entity
83 | on behalf of whom a Contribution has been received by Licensor and
84 | subsequently incorporated within the Work.
85 |
86 | 2. Grant of Copyright License. Subject to the terms and conditions of
87 | this License, each Contributor hereby grants to You a perpetual,
88 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
89 | copyright license to reproduce, prepare Derivative Works of,
90 | publicly display, publicly perform, sublicense, and distribute the
91 | Work and such Derivative Works in Source or Object form.
92 |
93 | 3. Grant of Patent License. Subject to the terms and conditions of
94 | this License, each Contributor hereby grants to You a perpetual,
95 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
96 | (except as stated in this section) patent license to make, have made,
97 | use, offer to sell, sell, import, and otherwise transfer the Work,
98 | where such license applies only to those patent claims licensable
99 | by such Contributor that are necessarily infringed by their
100 | Contribution(s) alone or by combination of their Contribution(s)
101 | with the Work to which such Contribution(s) was submitted. If You
102 | institute patent litigation against any entity (including a
103 | cross-claim or counterclaim in a lawsuit) alleging that the Work
104 | or a Contribution incorporated within the Work constitutes direct
105 | or contributory patent infringement, then any patent licenses
106 | granted to You under this License for that Work shall terminate
107 | as of the date such litigation is filed.
108 |
109 | 4. Redistribution. You may reproduce and distribute copies of the
110 | Work or Derivative Works thereof in any medium, with or without
111 | modifications, and in Source or Object form, provided that You
112 | meet the following conditions:
113 |
114 | (a) You must give any other recipients of the Work or
115 | Derivative Works a copy of this License; and
116 |
117 | (b) You must cause any modified files to carry prominent notices
118 | stating that You changed the files; and
119 |
120 | (c) You must retain, in the Source form of any Derivative Works
121 | that You distribute, all copyright, patent, trademark, and
122 | attribution notices from the Source form of the Work,
123 | excluding those notices that do not pertain to any part of
124 | the Derivative Works; and
125 |
126 | (d) If the Work includes a "NOTICE" text file as part of its
127 | distribution, then any Derivative Works that You distribute must
128 | include a readable copy of the attribution notices contained
129 | within such NOTICE file, excluding those notices that do not
130 | pertain to any part of the Derivative Works, in at least one
131 | of the following places: within a NOTICE text file distributed
132 | as part of the Derivative Works; within the Source form or
133 | documentation, if provided along with the Derivative Works; or,
134 | within a display generated by the Derivative Works, if and
135 | wherever such third-party notices normally appear. The contents
136 | of the NOTICE file are for informational purposes only and
137 | do not modify the License. You may add Your own attribution
138 | notices within Derivative Works that You distribute, alongside
139 | or as an addendum to the NOTICE text from the Work, provided
140 | that such additional attribution notices cannot be construed
141 | as modifying the License.
142 |
143 | You may add Your own copyright statement to Your modifications and
144 | may provide additional or different license terms and conditions
145 | for use, reproduction, or distribution of Your modifications, or
146 | for any such Derivative Works as a whole, provided Your use,
147 | reproduction, and distribution of the Work otherwise complies with
148 | the conditions stated in this License.
149 |
150 | 5. Submission of Contributions. Unless You explicitly state otherwise,
151 | any Contribution intentionally submitted for inclusion in the Work
152 | by You to the Licensor shall be under the terms and conditions of
153 | this License, without any additional terms or conditions.
154 | Notwithstanding the above, nothing herein shall supersede or modify
155 | the terms of any separate license agreement you may have executed
156 | with Licensor regarding such Contributions.
157 |
158 | 6. Trademarks. This License does not grant permission to use the trade
159 | names, trademarks, service marks, or product names of the Licensor,
160 | except as required for reasonable and customary use in describing the
161 | origin of the Work and reproducing the content of the NOTICE file.
162 |
163 | 7. Disclaimer of Warranty. Unless required by applicable law or
164 | agreed to in writing, Licensor provides the Work (and each
165 | Contributor provides its Contributions) on an "AS IS" BASIS,
166 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
167 | implied, including, without limitation, any warranties or conditions
168 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
169 | PARTICULAR PURPOSE. You are solely responsible for determining the
170 | appropriateness of using or redistributing the Work and assume any
171 | risks associated with Your exercise of permissions under this License.
172 |
173 | 8. Limitation of Liability. In no event and under no legal theory,
174 | whether in tort (including negligence), contract, or otherwise,
175 | unless required by applicable law (such as deliberate and grossly
176 | negligent acts) or agreed to in writing, shall any Contributor be
177 | liable to You for damages, including any direct, indirect, special,
178 | incidental, or consequential damages of any character arising as a
179 | result of this License or out of the use or inability to use the
180 | Work (including but not limited to damages for loss of goodwill,
181 | work stoppage, computer failure or malfunction, or any and all
182 | other commercial damages or losses), even if such Contributor
183 | has been advised of the possibility of such damages.
184 |
185 | 9. Accepting Warranty or Additional Liability. While redistributing
186 | the Work or Derivative Works thereof, You may choose to offer,
187 | and charge a fee for, acceptance of support, warranty, indemnity,
188 | or other liability obligations and/or rights consistent with this
189 | License. However, in accepting such obligations, You may act only
190 | on Your own behalf and on Your sole responsibility, not on behalf
191 | of any other Contributor, and only if You agree to indemnify,
192 | defend, and hold each Contributor harmless for any liability
193 | incurred by, or claims asserted against, such Contributor by reason
194 | of your accepting any such warranty or additional liability.
195 |
196 | END OF TERMS AND CONDITIONS
--------------------------------------------------------------------------------
/modules/core/README.md:
--------------------------------------------------------------------------------
1 | @react-mapboxgl/core
2 | ====================
3 |
4 | This is the core module for `@react-mapboxgl`. Please see the [main README](https://github.com/TerraEclipse/react-mapboxgl) or the [documentation](https://terraeclipse.github.io/react-mapboxgl).
5 |
6 | - - -
7 |
8 | #### Developed by [TerraEclipse](https://github.com/TerraEclipse)
9 |
10 | Terra Eclipse, Inc. is a nationally recognized political technology and
11 | strategy firm located in Santa Cruz, CA and Washington, D.C.
12 |
--------------------------------------------------------------------------------
/modules/core/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@react-mapboxgl/core",
3 | "version": "2.1.3",
4 | "publishConfig": {
5 | "access": "public"
6 | },
7 | "description": "Core module for @react-mapboxgl",
8 | "standard": {
9 | "parser": "babel-eslint"
10 | },
11 | "main": "lib/index.js",
12 | "module": "es/index.js",
13 | "files": [
14 | "es",
15 | "lib"
16 | ],
17 | "scripts": {
18 | "prepublish": "yarn run build",
19 | "build": "../../tools/build-module",
20 | "clean": "../../tools/clean-module",
21 | "test": "../../tools/test-module",
22 | "coverage": "../../tools/test-module --coverage"
23 | },
24 | "dependencies": {
25 | "@react-mapboxgl/docs": "^2.1.0"
26 | },
27 | "peerDependencies": {
28 | "lodash": "^4.17.4",
29 | "prop-types": "^15.5.10",
30 | "react": "^15.5.4"
31 | },
32 | "devDependencies": {
33 | "lodash": "^4.17.4",
34 | "mapbox-gl": "^0.37.0",
35 | "prop-types": "^15.5.10",
36 | "react": "^15.5.4"
37 | },
38 | "author": "Brian Link",
39 | "license": "Apache-2.0",
40 | "repository": {
41 | "type": "git",
42 | "url": "git+https://github.com/TerraEclipse/react-mapboxgl.git"
43 | },
44 | "bugs": {
45 | "url": "https://github.com/TerraEclipse/react-mapboxgl/issues"
46 | },
47 | "homepage": "https://github.com/TerraEclipse/react-mapboxgl/tree/master/modules/react-mapbox#readme",
48 | "keywords": [
49 | "react-component"
50 | ]
51 | }
52 |
--------------------------------------------------------------------------------
/modules/core/src/Children.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | /**
4 | * Just a placeholder until rendering arrays is possible (React 16), so I can
5 | * easily find-replace and, until then, apply styling if needed.
6 | */
7 | export default class Children extends React.PureComponent {
8 | render () {
9 | return (
10 |
51 | EatBar (2761 Washington Boulevard Arlington VA) is throwing
52 | a Big Backyard Beach Bash and Wine Fest on Saturday,
57 | serving up conch fritters, fish tacos and crab sliders, and
58 | Red Apron hot dogs. 12:00-3:00 p.m. $25.grill hot dogs.
59 |
122 | )
123 | }
124 | }
125 |
126 | export default Story
127 |
--------------------------------------------------------------------------------
/modules/core/src/util/__snapshots__/diff.test.js.snap:
--------------------------------------------------------------------------------
1 | // Jest Snapshot v1, https://goo.gl/fbAQLP
2 |
3 | exports[`diff can diff two objects 1`] = `
4 | Array [
5 | Object {
6 | "key": "favorite",
7 | "type": "remove",
8 | "value": true,
9 | },
10 | Object {
11 | "key": "vegetarian",
12 | "type": "add",
13 | "value": false,
14 | },
15 | Object {
16 | "key": "name",
17 | "type": "update",
18 | "value": "bacon quiche",
19 | },
20 | Object {
21 | "key": "ingredients",
22 | "type": "update",
23 | "value": Array [
24 | "eggs",
25 | "cream",
26 | "cheese",
27 | "bacon",
28 | ],
29 | },
30 | Object {
31 | "key": "status",
32 | "type": "update",
33 | "value": Object {
34 | "ate": true,
35 | "baked": true,
36 | "prepared": true,
37 | },
38 | },
39 | ]
40 | `;
41 |
--------------------------------------------------------------------------------
/modules/core/src/util/diff.js:
--------------------------------------------------------------------------------
1 | import _ from 'lodash'
2 |
3 | /**
4 | * Produces a shallow diff of an object. Output is an array of
5 | * 'changes' where a change is either an 'add', 'remove', or 'update'.
6 | */
7 | export default function diff (a, b) {
8 | // Throw is a or b are not objects.
9 | if (!_.isPlainObject(a)) {
10 | throw new Error('First parameter to diff() is not an object')
11 | }
12 | if (!_.isPlainObject(b)) {
13 | throw new Error('Second parameter to diff() is not an object')
14 | }
15 |
16 | let changes = []
17 | let keysA = _.keys(a)
18 | let keysB = _.keys(b)
19 |
20 | // Find the items in A that are not in B.
21 | _.each(_.difference(keysA, keysB), (key) => {
22 | changes.push({type: 'remove', key: key, value: a[key]})
23 | })
24 |
25 | // Find the items in B that are not in A.
26 | _.each(_.difference(keysB, keysA), (key) => {
27 | changes.push({type: 'add', key: key, value: b[key]})
28 | })
29 |
30 | // Find the items that are in both, but have changed.
31 | _.each(_.intersection(keysA, keysB), (key) => {
32 | if (!_.isEqual(a[key], b[key])) {
33 | changes.push({type: 'update', key: key, value: b[key]})
34 | }
35 | })
36 |
37 | return changes
38 | }
39 |
--------------------------------------------------------------------------------
/modules/core/src/util/diff.test.js:
--------------------------------------------------------------------------------
1 | /* eslint-env jest */
2 | import diff from './diff'
3 |
4 | describe('diff', () => {
5 | it('can diff two objects', () => {
6 | var a = {
7 | meal: 'dinner',
8 | name: 'quiche',
9 | ingredients: [
10 | 'eggs',
11 | 'cream',
12 | 'cheese'
13 | ],
14 | status: {
15 | prepared: true,
16 | baked: false,
17 | ate: false
18 | },
19 | favorite: true
20 | }
21 | var b = {
22 | meal: 'dinner',
23 | name: 'bacon quiche',
24 | ingredients: [
25 | 'eggs',
26 | 'cream',
27 | 'cheese',
28 | 'bacon'
29 | ],
30 | status: {
31 | prepared: true,
32 | baked: true,
33 | ate: true
34 | },
35 | vegetarian: false
36 | }
37 | var changes = diff(a, b)
38 | expect(changes).toMatchSnapshot()
39 | })
40 | })
41 |
--------------------------------------------------------------------------------
/modules/core/src/util/loadCSS.js:
--------------------------------------------------------------------------------
1 | export default function loadCSS (url) {
2 | return new Promise((resolve, reject) => {
3 | try {
4 | var style = document.createElement('style')
5 | style.textContent = '@import "' + url + '"'
6 |
7 | var fi = setInterval(function () {
8 | try {
9 | // Only populated when file is loaded
10 | if (style.sheet.cssRules) {
11 | clearInterval(fi)
12 | resolve()
13 | }
14 | } catch (e) {}
15 | }, 10)
16 |
17 | document.head.appendChild(style)
18 | } catch (err) {
19 | reject(err)
20 | }
21 | })
22 | }
23 |
--------------------------------------------------------------------------------
/modules/core/src/util/loadScript.js:
--------------------------------------------------------------------------------
1 | export default function loadScript (src) {
2 | return new Promise((resolve, reject) => {
3 | try {
4 | var script = document.createElement('script')
5 | script.src = src
6 | script.onload = resolve
7 | script.onerror = reject
8 | document.head.appendChild(script)
9 | } catch (err) {
10 | reject(err)
11 | }
12 | })
13 | }
14 |
--------------------------------------------------------------------------------
/modules/docs/.gitignore:
--------------------------------------------------------------------------------
1 | /coverage
2 | /es
3 | /lib
4 | /node_modules
5 | npm-debug.log
6 |
--------------------------------------------------------------------------------
/modules/docs/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2017 Terra Eclipse, Inc.
2 | http://www.terraeclipse.com/
3 |
4 | Copyright 2017 Brian Link
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 |
18 |
19 | -------------------------------------------------------------------------
20 | Apache License
21 | Version 2.0, January 2004
22 | http://www.apache.org/licenses/
23 |
24 |
25 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
26 |
27 | 1. Definitions.
28 |
29 | "License" shall mean the terms and conditions for use, reproduction,
30 | and distribution as defined by Sections 1 through 9 of this document.
31 |
32 | "Licensor" shall mean the copyright owner or entity authorized by
33 | the copyright owner that is granting the License.
34 |
35 | "Legal Entity" shall mean the union of the acting entity and all
36 | other entities that control, are controlled by, or are under common
37 | control with that entity. For the purposes of this definition,
38 | "control" means (i) the power, direct or indirect, to cause the
39 | direction or management of such entity, whether by contract or
40 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
41 | outstanding shares, or (iii) beneficial ownership of such entity.
42 |
43 | "You" (or "Your") shall mean an individual or Legal Entity
44 | exercising permissions granted by this License.
45 |
46 | "Source" form shall mean the preferred form for making modifications,
47 | including but not limited to software source code, documentation
48 | source, and configuration files.
49 |
50 | "Object" form shall mean any form resulting from mechanical
51 | transformation or translation of a Source form, including but
52 | not limited to compiled object code, generated documentation,
53 | and conversions to other media types.
54 |
55 | "Work" shall mean the work of authorship, whether in Source or
56 | Object form, made available under the License, as indicated by a
57 | copyright notice that is included in or attached to the work
58 | (an example is provided in the Appendix below).
59 |
60 | "Derivative Works" shall mean any work, whether in Source or Object
61 | form, that is based on (or derived from) the Work and for which the
62 | editorial revisions, annotations, elaborations, or other modifications
63 | represent, as a whole, an original work of authorship. For the purposes
64 | of this License, Derivative Works shall not include works that remain
65 | separable from, or merely link (or bind by name) to the interfaces of,
66 | the Work and Derivative Works thereof.
67 |
68 | "Contribution" shall mean any work of authorship, including
69 | the original version of the Work and any modifications or additions
70 | to that Work or Derivative Works thereof, that is intentionally
71 | submitted to Licensor for inclusion in the Work by the copyright owner
72 | or by an individual or Legal Entity authorized to submit on behalf of
73 | the copyright owner. For the purposes of this definition, "submitted"
74 | means any form of electronic, verbal, or written communication sent
75 | to the Licensor or its representatives, including but not limited to
76 | communication on electronic mailing lists, source code control systems,
77 | and issue tracking systems that are managed by, or on behalf of, the
78 | Licensor for the purpose of discussing and improving the Work, but
79 | excluding communication that is conspicuously marked or otherwise
80 | designated in writing by the copyright owner as "Not a Contribution."
81 |
82 | "Contributor" shall mean Licensor and any individual or Legal Entity
83 | on behalf of whom a Contribution has been received by Licensor and
84 | subsequently incorporated within the Work.
85 |
86 | 2. Grant of Copyright License. Subject to the terms and conditions of
87 | this License, each Contributor hereby grants to You a perpetual,
88 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
89 | copyright license to reproduce, prepare Derivative Works of,
90 | publicly display, publicly perform, sublicense, and distribute the
91 | Work and such Derivative Works in Source or Object form.
92 |
93 | 3. Grant of Patent License. Subject to the terms and conditions of
94 | this License, each Contributor hereby grants to You a perpetual,
95 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
96 | (except as stated in this section) patent license to make, have made,
97 | use, offer to sell, sell, import, and otherwise transfer the Work,
98 | where such license applies only to those patent claims licensable
99 | by such Contributor that are necessarily infringed by their
100 | Contribution(s) alone or by combination of their Contribution(s)
101 | with the Work to which such Contribution(s) was submitted. If You
102 | institute patent litigation against any entity (including a
103 | cross-claim or counterclaim in a lawsuit) alleging that the Work
104 | or a Contribution incorporated within the Work constitutes direct
105 | or contributory patent infringement, then any patent licenses
106 | granted to You under this License for that Work shall terminate
107 | as of the date such litigation is filed.
108 |
109 | 4. Redistribution. You may reproduce and distribute copies of the
110 | Work or Derivative Works thereof in any medium, with or without
111 | modifications, and in Source or Object form, provided that You
112 | meet the following conditions:
113 |
114 | (a) You must give any other recipients of the Work or
115 | Derivative Works a copy of this License; and
116 |
117 | (b) You must cause any modified files to carry prominent notices
118 | stating that You changed the files; and
119 |
120 | (c) You must retain, in the Source form of any Derivative Works
121 | that You distribute, all copyright, patent, trademark, and
122 | attribution notices from the Source form of the Work,
123 | excluding those notices that do not pertain to any part of
124 | the Derivative Works; and
125 |
126 | (d) If the Work includes a "NOTICE" text file as part of its
127 | distribution, then any Derivative Works that You distribute must
128 | include a readable copy of the attribution notices contained
129 | within such NOTICE file, excluding those notices that do not
130 | pertain to any part of the Derivative Works, in at least one
131 | of the following places: within a NOTICE text file distributed
132 | as part of the Derivative Works; within the Source form or
133 | documentation, if provided along with the Derivative Works; or,
134 | within a display generated by the Derivative Works, if and
135 | wherever such third-party notices normally appear. The contents
136 | of the NOTICE file are for informational purposes only and
137 | do not modify the License. You may add Your own attribution
138 | notices within Derivative Works that You distribute, alongside
139 | or as an addendum to the NOTICE text from the Work, provided
140 | that such additional attribution notices cannot be construed
141 | as modifying the License.
142 |
143 | You may add Your own copyright statement to Your modifications and
144 | may provide additional or different license terms and conditions
145 | for use, reproduction, or distribution of Your modifications, or
146 | for any such Derivative Works as a whole, provided Your use,
147 | reproduction, and distribution of the Work otherwise complies with
148 | the conditions stated in this License.
149 |
150 | 5. Submission of Contributions. Unless You explicitly state otherwise,
151 | any Contribution intentionally submitted for inclusion in the Work
152 | by You to the Licensor shall be under the terms and conditions of
153 | this License, without any additional terms or conditions.
154 | Notwithstanding the above, nothing herein shall supersede or modify
155 | the terms of any separate license agreement you may have executed
156 | with Licensor regarding such Contributions.
157 |
158 | 6. Trademarks. This License does not grant permission to use the trade
159 | names, trademarks, service marks, or product names of the Licensor,
160 | except as required for reasonable and customary use in describing the
161 | origin of the Work and reproducing the content of the NOTICE file.
162 |
163 | 7. Disclaimer of Warranty. Unless required by applicable law or
164 | agreed to in writing, Licensor provides the Work (and each
165 | Contributor provides its Contributions) on an "AS IS" BASIS,
166 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
167 | implied, including, without limitation, any warranties or conditions
168 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
169 | PARTICULAR PURPOSE. You are solely responsible for determining the
170 | appropriateness of using or redistributing the Work and assume any
171 | risks associated with Your exercise of permissions under this License.
172 |
173 | 8. Limitation of Liability. In no event and under no legal theory,
174 | whether in tort (including negligence), contract, or otherwise,
175 | unless required by applicable law (such as deliberate and grossly
176 | negligent acts) or agreed to in writing, shall any Contributor be
177 | liable to You for damages, including any direct, indirect, special,
178 | incidental, or consequential damages of any character arising as a
179 | result of this License or out of the use or inability to use the
180 | Work (including but not limited to damages for loss of goodwill,
181 | work stoppage, computer failure or malfunction, or any and all
182 | other commercial damages or losses), even if such Contributor
183 | has been advised of the possibility of such damages.
184 |
185 | 9. Accepting Warranty or Additional Liability. While redistributing
186 | the Work or Derivative Works thereof, You may choose to offer,
187 | and charge a fee for, acceptance of support, warranty, indemnity,
188 | or other liability obligations and/or rights consistent with this
189 | License. However, in accepting such obligations, You may act only
190 | on Your own behalf and on Your sole responsibility, not on behalf
191 | of any other Contributor, and only if You agree to indemnify,
192 | defend, and hold each Contributor harmless for any liability
193 | incurred by, or claims asserted against, such Contributor by reason
194 | of your accepting any such warranty or additional liability.
195 |
196 | END OF TERMS AND CONDITIONS
--------------------------------------------------------------------------------
/modules/docs/README.md:
--------------------------------------------------------------------------------
1 | @react-mapboxgl/docs
2 | ====================
3 |
4 | This module provides documentation helpers for `@react-mapboxgl`. Please see
5 | the [main README](https://github.com/TerraEclipse/react-mapboxgl) or the [documentation](https://terraeclipse.github.io/react-mapboxgl).
6 |
7 | - - -
8 |
9 | #### Developed by [TerraEclipse](https://github.com/TerraEclipse)
10 |
11 | Terra Eclipse, Inc. is a nationally recognized political technology and
12 | strategy firm located in Santa Cruz, CA and Washington, D.C.
13 |
--------------------------------------------------------------------------------
/modules/docs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@react-mapboxgl/docs",
3 | "version": "2.1.0",
4 | "publishConfig": {
5 | "access": "public"
6 | },
7 | "description": "Documentation (storybook) helpers for @react-mapboxgl",
8 | "standard": {
9 | "parser": "babel-eslint"
10 | },
11 | "main": "lib/index.js",
12 | "module": "es/index.js",
13 | "files": [
14 | "es",
15 | "lib"
16 | ],
17 | "scripts": {
18 | "prepublish": "yarn run build",
19 | "build": "../../tools/build-module",
20 | "clean": "../../tools/clean-module",
21 | "test": "../../tools/test-module",
22 | "coverage": "../../tools/test-module --coverage"
23 | },
24 | "peerDependencies": {
25 | "lodash": "^4.17.4",
26 | "prop-types": "^15.5.10",
27 | "react": "^15.5.4"
28 | },
29 | "devDependencies": {
30 | "lodash": "^4.17.4",
31 | "prop-types": "^15.5.10",
32 | "react": "^15.5.4"
33 | },
34 | "author": "Brian Link",
35 | "license": "Apache-2.0",
36 | "repository": {
37 | "type": "git",
38 | "url": "git+https://github.com/TerraEclipse/react-mapboxgl.git"
39 | },
40 | "bugs": {
41 | "url": "https://github.com/TerraEclipse/react-mapboxgl/issues"
42 | },
43 | "homepage": "https://github.com/TerraEclipse/react-mapboxgl/tree/master/modules/docs#readme",
44 | "keywords": [
45 | "react-component"
46 | ]
47 | }
48 |
--------------------------------------------------------------------------------
/modules/docs/src/components/Checkbox.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | export default function Checkbox (props) {
4 | return (
5 |
18 | )
19 | }
20 |
--------------------------------------------------------------------------------
/modules/docs/src/components/Options.css:
--------------------------------------------------------------------------------
1 | .storybook-options {
2 | display: flex;
3 | flex-direction: row;
4 | flex-wrap: wrap;
5 | background: #555;
6 | margin: 20px -20px -20px -20px !important;
7 | }
8 | .storybook-options > * {
9 | flex: 0 0 25%;
10 | font-size: 0.85em;
11 | padding: 7px;
12 | border: 2px solid rgba(0, 0, 0, 0.1);
13 | background: rgba(0, 0, 0, 0.1);
14 | }
--------------------------------------------------------------------------------
/modules/docs/src/components/Options.js:
--------------------------------------------------------------------------------
1 | import './Options.css'
2 | import React from 'react'
3 |
4 | export default function Options (props) {
5 | return (
6 |