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 |
149 | )
150 | }
151 | }
152 |
153 | export default MapGL
154 |
--------------------------------------------------------------------------------
/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/src/stories/images.story.src.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Core - Images
3 | *
4 | * ## Load and Use Custom Images
5 | * Loads images into the map sprite (limited size), then use them in
6 | * layer paint options. Assumes a webpack setup with `url-loader` for images.
7 | */
8 | import React from 'react'
9 | import {mapDefaults, Overlay} from '@react-mapboxgl/docs'
10 | import {MapGL, LoadImages, Layer} from '../'
11 |
12 | class Story extends React.Component {
13 | state = {
14 | pattern: 'greenPattern'
15 | }
16 |
17 | constructor () {
18 | super()
19 | this.handleClick = this.handleClick.bind(this)
20 | }
21 |
22 | handleClick () {
23 | this.setState((state) => {
24 | state.pattern = (state.pattern === 'greenPattern')
25 | ? 'orangePattern'
26 | : 'greenPattern'
27 | return state
28 | })
29 | }
30 |
31 | render () {
32 | return (
33 |
34 |
40 |
75 |
114 |
115 |
116 |
117 |
118 |
119 | )
120 | }
121 | }
122 |
123 | export default Story
124 |
--------------------------------------------------------------------------------
/modules/toggle/src/Toggle.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import _ from 'lodash'
4 | import {Children} from '@react-mapboxgl/core'
5 | import Click from '@react-mapboxgl/click'
6 |
7 | class Toggle extends React.Component {
8 | static propTypes = {
9 | layer: PropTypes.string.isRequired,
10 | property: PropTypes.string.isRequired,
11 | multiple: PropTypes.bool,
12 | clickEvent: PropTypes.string,
13 | avoidDoubleClick: PropTypes.bool,
14 | doubleClickSpeed: PropTypes.number,
15 | closeOnClickOutside: PropTypes.bool,
16 | onToggle: PropTypes.func,
17 | children: PropTypes.func
18 | }
19 |
20 | static defaultProps = {
21 | multiple: false,
22 | closeOnClickOutside: true
23 | }
24 |
25 | static contextTypes = {
26 | map: PropTypes.object
27 | }
28 |
29 | state = {
30 | features: {}
31 | }
32 |
33 | constructor () {
34 | super()
35 | this.handleClickLayer = this.handleClickLayer.bind(this)
36 | this.handleClickMap = this.handleClickMap.bind(this)
37 | this.toggleFeature = this.toggleFeature.bind(this)
38 | }
39 |
40 | componentWillReceiveProps (nextProps) {
41 | if (this.props.layer !== nextProps.layer) {
42 | this.setState({features: {}})
43 | }
44 | if (this.props.multiple !== nextProps.multiple) {
45 | if (!nextProps.multiple && !_.isEmpty(this.state.features)) {
46 | let key = _.keys(this.state.features).pop()
47 | this.setState({features: {
48 | [key]: this.state.features[key]
49 | }})
50 | }
51 | }
52 | }
53 |
54 | handleClickLayer (e) {
55 | if (this.props.multiple) {
56 | _.each(e.features, this.toggleFeature)
57 | } else if (e.features.length) {
58 | this.toggleFeature(e.features[0])
59 | }
60 | }
61 |
62 | handleClickMap (e) {
63 | let {map} = this.context
64 | let features = map.queryRenderedFeatures(e.point, {
65 | layers: [this.props.layer]
66 | })
67 | if (!features.length) {
68 | if (this.props.closeOnClickOutside) {
69 | this.setState({features: {}})
70 | }
71 | } else if (this.props.multiple) {
72 | _.each(features, this.toggleFeature)
73 | } else {
74 | this.toggleFeature(features[0])
75 | }
76 | }
77 |
78 | toggleFeature (feature) {
79 | let {features} = this.state
80 | let property = this.getProperty(feature)
81 | let isOn = true
82 |
83 | if (this.props.multiple) {
84 | if (this.state.features[property]) {
85 | isOn = false
86 | delete features[property]
87 | } else {
88 | features[property] = feature
89 | }
90 | } else {
91 | if (features[property]) {
92 | isOn = false
93 | features = {}
94 | } else {
95 | features = {[property]: feature}
96 | }
97 | }
98 |
99 | if (this.props.onToggle) {
100 | this.props.onToggle(feature, isOn)
101 | }
102 |
103 | this.setState({features})
104 | }
105 |
106 | getProperty (feature) {
107 | let propertyPath = `properties.${this.props.property}`
108 | let property = _.get(feature, propertyPath)
109 | if (typeof property !== 'undefined') {
110 | return property
111 | } else {
112 | throw new Error('Could not find property for feature')
113 | }
114 | }
115 |
116 | render () {
117 | return (
118 |
119 | {this.props.closeOnClickOutside ? (
120 |
126 | ) : (
127 |
134 | )}
135 | {this.props.children
136 | ? (typeof this.props.children === 'function')
137 | ? this.props.children({
138 | features: _.values(this.state.features),
139 | properties: _.keys(this.state.features)
140 | })
141 | : this.props.children
142 | : null
143 | }
144 |
145 | )
146 | }
147 | }
148 |
149 | export default Toggle
150 |
--------------------------------------------------------------------------------
/modules/core/src/Popup.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import PropTypes from 'prop-types'
4 | import _ from 'lodash'
5 |
6 | /**
7 | * Open a mapbox-gl 'native' popup.
8 | *
9 | * Note: It's usually not going to be a good idea to use the `closeButton` or
10 | * `closeOnClick` options, because they can conflict with the mounted state of
11 | * your popup. You should instead 'close' your own component by simply
12 | * unrendering it. If you want a close button, it would be better to render and
13 | * manage it yourself (tied to some state that controls the rendering of the
14 | * Popup).
15 | */
16 | class Popup extends React.Component {
17 | static propTypes = {
18 | // Popup options.
19 | closeButton: PropTypes.bool,
20 | closeOnClick: PropTypes.bool,
21 | anchor: PropTypes.string,
22 | offset: PropTypes.oneOfType([
23 | PropTypes.number,
24 | PropTypes.array,
25 | PropTypes.object
26 | ]),
27 |
28 | // Coordinates.
29 | coordinates: PropTypes.array,
30 |
31 | // Only one of the following.
32 | text: PropTypes.string,
33 | html: PropTypes.string,
34 | children: PropTypes.node,
35 |
36 | // Events.
37 | onClose: PropTypes.func
38 | }
39 |
40 | static defaultProps = {
41 | closeButton: false,
42 | closeOnClick: false
43 | }
44 |
45 | static contextTypes = {
46 | map: PropTypes.object,
47 | mapboxgl: PropTypes.object
48 | }
49 |
50 | shouldComponentUpdate (nextProps, nextState) {
51 | return (
52 | !_.isEqual(this.props, nextProps) ||
53 | !_.isEqual(this.state, nextState)
54 | )
55 | }
56 |
57 | componentDidMount () {
58 | // Setup popup div.
59 | this.el = document.createElement('div')
60 | this.el.className = 'react-mapbox--popup'
61 | _.extend(this.el.style, {
62 | position: 'relative',
63 | display: 'inline-block'
64 | })
65 |
66 | // Add popup to map.
67 | this.addPopup(this.props)
68 | }
69 |
70 | componentWillUnmount () {
71 | if (this.component) {
72 | ReactDOM.unmountComponentAtNode(this.el)
73 | this.component = null
74 | }
75 | this.removePopup()
76 | this.el = null
77 | }
78 |
79 | componentWillReceiveProps (nextProps) {
80 | // For options or content, we need to make a new popup.
81 | if (
82 | !_.isEqual(this.getOptions(this.props), this.getOptions(nextProps)) ||
83 | !_.isEqual(this.props.html, nextProps.html) ||
84 | !_.isEqual(this.props.text, nextProps.text) ||
85 | !_.isEqual(this.props.onClose, nextProps.onClose)
86 | ) {
87 | this.removePopup()
88 | this.addPopup(nextProps)
89 | return
90 | }
91 |
92 | // Otherwise update the current popup.
93 | if (!_.isEqual(this.props.coordinates, nextProps.coordinates)) {
94 | this.popup.setLngLat(nextProps.coordinates)
95 | }
96 | if (this.props.children !== nextProps.children) {
97 | this.renderChildren(nextProps)
98 | }
99 | }
100 |
101 | getOptions (props) {
102 | return _.omitBy(_.pick(props, [
103 | 'closeButton',
104 | 'closeOnClick',
105 | 'anchor',
106 | 'offset'
107 | ]), _.isNil)
108 | }
109 |
110 | addPopup (props) {
111 | let {map, mapboxgl} = this.context
112 | this.popup = new mapboxgl.Popup(this.getOptions(props))
113 | if (this.props.onClose) {
114 | this.popup.on('close', this.props.onClose)
115 | }
116 | if (props.coordinates) {
117 | this.popup.setLngLat(props.coordinates)
118 | }
119 | if (props.html) {
120 | this.popup.setHTML(props.html)
121 | }
122 | if (props.text) {
123 | this.popup.setText(props.text)
124 | }
125 | if (props.children) {
126 | this.renderChildren(props)
127 | this.popup.setDOMContent(this.el)
128 | }
129 | this.popup.addTo(map)
130 | }
131 |
132 | removePopup () {
133 | if (this.popup.isOpen()) {
134 | this.popup.off('close')
135 | this.popup.remove()
136 | }
137 | this.popup = null
138 | }
139 |
140 | renderChildren (props) {
141 | if (this.component) {
142 | ReactDOM.unmountComponentAtNode(this.el)
143 | }
144 | if (props.children) {
145 | this.component = ReactDOM.unstable_renderSubtreeIntoContainer(
146 | this,
147 | props.children,
148 | this.el
149 | )
150 | }
151 | }
152 |
153 | render () {
154 | return null
155 | }
156 | }
157 |
158 | export default Popup
159 |
--------------------------------------------------------------------------------
/modules/toggle/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.0.3":
6 | version "2.0.3"
7 | resolved "https://registry.npmjs.org/@react-mapboxgl/click/-/click-2.0.3.tgz#92b7252ec72df857d1583891b229f4df59b63ae5"
8 | dependencies:
9 | "@react-mapboxgl/core" "^2.0.3"
10 | "@react-mapboxgl/docs" "^2.0.0"
11 |
12 | "@react-mapboxgl/core@^2.0.3":
13 | version "2.0.3"
14 | resolved "https://registry.npmjs.org/@react-mapboxgl/core/-/core-2.0.3.tgz#f76c3c4d83c3da29a528bfe393bb9482ade76b46"
15 | dependencies:
16 | "@react-mapboxgl/docs" "^2.0.0"
17 |
18 | "@react-mapboxgl/docs@^2.0.0":
19 | version "2.0.0"
20 | resolved "https://registry.npmjs.org/@react-mapboxgl/docs/-/docs-2.0.0.tgz#c4110f34f423a05e55cc7cb8e0646dc44a1be2c5"
21 |
22 | asap@~2.0.3:
23 | version "2.0.5"
24 | resolved "https://registry.npmjs.org/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f"
25 |
26 | core-js@^1.0.0:
27 | version "1.2.7"
28 | resolved "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
29 |
30 | encoding@^0.1.11:
31 | version "0.1.12"
32 | resolved "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
33 | dependencies:
34 | iconv-lite "~0.4.13"
35 |
36 | fbjs@^0.8.9:
37 | version "0.8.12"
38 | resolved "https://registry.npmjs.org/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04"
39 | dependencies:
40 | core-js "^1.0.0"
41 | isomorphic-fetch "^2.1.1"
42 | loose-envify "^1.0.0"
43 | object-assign "^4.1.0"
44 | promise "^7.1.1"
45 | setimmediate "^1.0.5"
46 | ua-parser-js "^0.7.9"
47 |
48 | iconv-lite@~0.4.13:
49 | version "0.4.17"
50 | resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.17.tgz#4fdaa3b38acbc2c031b045d0edcdfe1ecab18c8d"
51 |
52 | is-stream@^1.0.1:
53 | version "1.1.0"
54 | resolved "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
55 |
56 | isomorphic-fetch@^2.1.1:
57 | version "2.2.1"
58 | resolved "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
59 | dependencies:
60 | node-fetch "^1.0.1"
61 | whatwg-fetch ">=0.10.0"
62 |
63 | js-tokens@^3.0.0:
64 | version "3.0.1"
65 | resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7"
66 |
67 | lodash@^4.17.4:
68 | version "4.17.4"
69 | resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
70 |
71 | loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1:
72 | version "1.3.1"
73 | resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
74 | dependencies:
75 | js-tokens "^3.0.0"
76 |
77 | node-fetch@^1.0.1:
78 | version "1.7.1"
79 | resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.1.tgz#899cb3d0a3c92f952c47f1b876f4c8aeabd400d5"
80 | dependencies:
81 | encoding "^0.1.11"
82 | is-stream "^1.0.1"
83 |
84 | object-assign@^4.1.0:
85 | version "4.1.1"
86 | resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
87 |
88 | promise@^7.1.1:
89 | version "7.1.1"
90 | resolved "https://registry.npmjs.org/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf"
91 | dependencies:
92 | asap "~2.0.3"
93 |
94 | prop-types@^15.5.10, prop-types@^15.5.7:
95 | version "15.5.10"
96 | resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
97 | dependencies:
98 | fbjs "^0.8.9"
99 | loose-envify "^1.3.1"
100 |
101 | react@^15.5.4:
102 | version "15.5.4"
103 | resolved "https://registry.npmjs.org/react/-/react-15.5.4.tgz#fa83eb01506ab237cdc1c8c3b1cea8de012bf047"
104 | dependencies:
105 | fbjs "^0.8.9"
106 | loose-envify "^1.1.0"
107 | object-assign "^4.1.0"
108 | prop-types "^15.5.7"
109 |
110 | setimmediate@^1.0.5:
111 | version "1.0.5"
112 | resolved "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
113 |
114 | ua-parser-js@^0.7.9:
115 | version "0.7.12"
116 | resolved "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb"
117 |
118 | whatwg-fetch@>=0.10.0:
119 | version "2.0.3"
120 | resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"
121 |
--------------------------------------------------------------------------------
/modules/core/src/Layer.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import _ from 'lodash'
4 | import diff from './util/diff'
5 | import Children from './Children'
6 | import Source from './Source'
7 | import LayerEvents from './LayerEvents'
8 |
9 | class Layer extends React.Component {
10 | static propTypes = {
11 | id: PropTypes.string.isRequired,
12 | type: PropTypes.oneOf([
13 | 'fill',
14 | 'line',
15 | 'symbol',
16 | 'circle',
17 | 'fill-extrusion',
18 | 'raster',
19 | 'background'
20 | ]).isRequired,
21 | source: PropTypes.oneOfType([
22 | PropTypes.string,
23 | PropTypes.object
24 | ]).isRequired,
25 | sourceLayer: PropTypes.string,
26 | metadata: PropTypes.object,
27 | copy: PropTypes.string,
28 | minzoom: PropTypes.number,
29 | maxzoom: PropTypes.number,
30 | filter: PropTypes.array,
31 | layout: PropTypes.object,
32 | paint: PropTypes.object,
33 | before: PropTypes.string
34 | // LayerEvents
35 | }
36 |
37 | static contextTypes = {
38 | map: PropTypes.object
39 | }
40 |
41 | state = {
42 | added: false
43 | }
44 |
45 | shouldComponentUpdate (nextProps, nextState) {
46 | return (
47 | !_.isEqual(this.props, nextProps) ||
48 | !_.isEqual(this.state, nextState)
49 | )
50 | }
51 |
52 | componentDidMount () {
53 | this.addLayer(this.props)
54 | }
55 |
56 | componentWillUnmount () {
57 | this.removeLayer(this.props)
58 | }
59 |
60 | componentWillReceiveProps (nextProps) {
61 | let {map} = this.context
62 |
63 | // Have to recreate layer if these change.
64 | if (
65 | !_.isEqual(this.props.id, nextProps.id) ||
66 | !_.isEqual(this.props.type, nextProps.type) ||
67 | !_.isEqual(this.props.source, nextProps.source) ||
68 | !_.isEqual(this.props.sourceLayer, nextProps.sourceLayer) ||
69 | !_.isEqual(this.props.metadata, nextProps.metadata) ||
70 | !_.isEqual(this.props.copy, nextProps.copy)
71 | ) {
72 | this.removeLayer(this.props)
73 | this.addLayer(nextProps)
74 | return
75 | }
76 |
77 | if (!_.isEqual(this.props.filter, nextProps.filter)) {
78 | map.setFilter(this.props.id, nextProps.filter)
79 | }
80 |
81 | _.each(diff(this.props.layout || {}, nextProps.layout || {}), ({type, key, value}) => {
82 | map.setLayoutProperty(this.props.id, key, type === 'remove' ? null : value)
83 | })
84 |
85 | _.each(diff(this.props.paint || {}, nextProps.paint || {}), ({type, key, value}) => {
86 | map.setPaintProperty(this.props.id, key, type === 'remove' ? null : value)
87 | })
88 |
89 | if (this.props.before !== nextProps.before) {
90 | map.moveLayer(this.props.id, nextProps.before)
91 | }
92 |
93 | if (this.props.minZoom !== nextProps.minZoom ||
94 | this.props.maxZoom !== nextProps.maxZoom) {
95 | map.setLayerZoomRange(this.props.id, nextProps.minZoom, nextProps.maxZoom)
96 | }
97 | }
98 |
99 | addLayer (props) {
100 | let {map} = this.context
101 | let options = {}
102 |
103 | // Grab basic options from props.
104 | _.extend(options, _.omitBy(_.pick(props, [
105 | 'id',
106 | 'type',
107 | 'metadata',
108 | 'minzoom',
109 | 'maxzoom',
110 | 'filter',
111 | 'layout',
112 | 'paint'
113 | ]), _.isNil))
114 |
115 | // Grab 'ref' from 'copy'.
116 | if (props.copy) {
117 | options.ref = props.copy
118 | }
119 |
120 | // Check if we have a source id or object.
121 | if (_.isPlainObject(props.source)) {
122 | options.source = props.source.id || `${props.id}-source`
123 | } else {
124 | options.source = props.source
125 | }
126 | if (props.sourceLayer) {
127 | options['source-layer'] = props.sourceLayer
128 | }
129 |
130 | // Add the layer to the map.
131 | map.addLayer(options, props.before)
132 | map.fire('_addLayer', props.id)
133 | this.setState({added: true})
134 | }
135 |
136 | removeLayer (props) {
137 | let {map} = this.context
138 | map.removeLayer(props.id)
139 | map.fire('_removeLayer', props.id)
140 | this.setState({added: false})
141 | }
142 |
143 | render () {
144 | return (
145 |
146 | {_.isPlainObject(this.props.source) ? (
147 |
151 | ) : null}
152 | {this.state.added ? (
153 |
157 | ) : null}
158 |
159 | )
160 | }
161 | }
162 |
163 | export default Layer
164 |
--------------------------------------------------------------------------------
/modules/hover/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 | "@terraeclipse/throttle-raf-decorator@^1.0.4":
16 | version "1.0.4"
17 | resolved "https://registry.npmjs.org/@terraeclipse/throttle-raf-decorator/-/throttle-raf-decorator-1.0.4.tgz#c23c37c20f5a433904d2284e1224fe51fde3f653"
18 | dependencies:
19 | raf "^3.3.2"
20 |
21 | asap@~2.0.3:
22 | version "2.0.5"
23 | resolved "https://registry.npmjs.org/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f"
24 |
25 | core-js@^1.0.0:
26 | version "1.2.7"
27 | resolved "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
28 |
29 | encoding@^0.1.11:
30 | version "0.1.12"
31 | resolved "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
32 | dependencies:
33 | iconv-lite "~0.4.13"
34 |
35 | fbjs@^0.8.9:
36 | version "0.8.12"
37 | resolved "https://registry.npmjs.org/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04"
38 | dependencies:
39 | core-js "^1.0.0"
40 | isomorphic-fetch "^2.1.1"
41 | loose-envify "^1.0.0"
42 | object-assign "^4.1.0"
43 | promise "^7.1.1"
44 | setimmediate "^1.0.5"
45 | ua-parser-js "^0.7.9"
46 |
47 | iconv-lite@~0.4.13:
48 | version "0.4.17"
49 | resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.17.tgz#4fdaa3b38acbc2c031b045d0edcdfe1ecab18c8d"
50 |
51 | is-stream@^1.0.1:
52 | version "1.1.0"
53 | resolved "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
54 |
55 | isomorphic-fetch@^2.1.1:
56 | version "2.2.1"
57 | resolved "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
58 | dependencies:
59 | node-fetch "^1.0.1"
60 | whatwg-fetch ">=0.10.0"
61 |
62 | js-tokens@^3.0.0:
63 | version "3.0.1"
64 | resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7"
65 |
66 | lodash@^4.17.4:
67 | version "4.17.4"
68 | resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
69 |
70 | loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1:
71 | version "1.3.1"
72 | resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
73 | dependencies:
74 | js-tokens "^3.0.0"
75 |
76 | node-fetch@^1.0.1:
77 | version "1.7.1"
78 | resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.1.tgz#899cb3d0a3c92f952c47f1b876f4c8aeabd400d5"
79 | dependencies:
80 | encoding "^0.1.11"
81 | is-stream "^1.0.1"
82 |
83 | object-assign@^4.1.0:
84 | version "4.1.1"
85 | resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
86 |
87 | performance-now@^2.1.0:
88 | version "2.1.0"
89 | resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
90 |
91 | promise@^7.1.1:
92 | version "7.1.1"
93 | resolved "https://registry.npmjs.org/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf"
94 | dependencies:
95 | asap "~2.0.3"
96 |
97 | prop-types@^15.5.10, prop-types@^15.5.7:
98 | version "15.5.10"
99 | resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154"
100 | dependencies:
101 | fbjs "^0.8.9"
102 | loose-envify "^1.3.1"
103 |
104 | raf@^3.3.2:
105 | version "3.3.2"
106 | resolved "https://registry.npmjs.org/raf/-/raf-3.3.2.tgz#0c13be0b5b49b46f76d6669248d527cf2b02fe27"
107 | dependencies:
108 | performance-now "^2.1.0"
109 |
110 | react@^15.5.4:
111 | version "15.5.4"
112 | resolved "https://registry.npmjs.org/react/-/react-15.5.4.tgz#fa83eb01506ab237cdc1c8c3b1cea8de012bf047"
113 | dependencies:
114 | fbjs "^0.8.9"
115 | loose-envify "^1.1.0"
116 | object-assign "^4.1.0"
117 | prop-types "^15.5.7"
118 |
119 | setimmediate@^1.0.5:
120 | version "1.0.5"
121 | resolved "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
122 |
123 | ua-parser-js@^0.7.9:
124 | version "0.7.12"
125 | resolved "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb"
126 |
127 | whatwg-fetch@>=0.10.0:
128 | version "2.0.3"
129 | resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"
130 |
--------------------------------------------------------------------------------
/modules/button-layer/README.md:
--------------------------------------------------------------------------------
1 | @react-mapboxgl/button-layer
2 | ============================
3 |
4 | The `ButtonLayer` component encapsulates several styled layers pointing to the
5 | same source. These layers provide the typical UI required for 'interactive'
6 | features.
7 |
8 | Props
9 | -----
10 |
11 | - **id (required):** The id for this layer.
12 | - **property (required):** The unique property to identify features.
13 | - **source:** The source (id or options).
14 | - **sourceLayer:** The source-layer (if relevant).
15 | - **base:** Options for the 'base' layer, the one that is always visible.
16 | - **borders:** Options for a borders layer (if relevant).
17 | - **hover:** Options for a hover layer (if relevant).
18 | - **hoverBorder:** Options for a hover-border layer (if relevant).
19 | - **active:** Options for an active layer (if relevant).
20 | - **activeBorder:** Options for an active border layer (if relevant).
21 | - **activeProperty:** The property value identifying the currently active feature (if one is active).
22 |
23 | Example
24 | -------
25 |
26 | An example usage. See it in action [in the storybook](https://terraeclipse.github.io/react-mapboxgl/?selectedKind=ButtonLayer&selectedStory=Example).
27 |
28 | ```js
29 | /**
30 | * ButtonLayer - Example
31 | *
32 | * ## ButtonLayer Example - Interactive Polygons
33 | *
34 | * Uses the ButtonLayer 'meta component' to add polygons
35 | * with border, hover, and active states.
36 | *
37 | * Toggle any polygon to 'zoom' into/out of it.
38 | */
39 | import React from 'react'
40 | import bbox from '@turf/bbox'
41 | import {MapboxProvider, MapGL} from '@react-mapboxgl/core'
42 | import Toggle from '@react-mapboxgl/toggle'
43 | import ButtonLayer from './'
44 |
45 | const mapOptions = {
46 | style: 'mapbox://styles/mapbox/streets-v9',
47 | bbox: [[-123.881836, 25.063209], [-65.170898, 48.848451]],
48 | center: [-95.844727, 39.620499],
49 | zoom: 3,
50 | padding: 30,
51 | containerStyle: {
52 | position: 'fixed',
53 | top: 0,
54 | left: 0,
55 | right: 0,
56 | bottom: 0,
57 | zIndex: 1
58 | }
59 | }
60 |
61 | class Example extends React.Component {
62 | state = {
63 | activeName: null,
64 | bbox: mapOptions.bbox
65 | }
66 |
67 | constructor () {
68 | super()
69 | this.handleToggle = this.handleToggle.bind(this)
70 | }
71 |
72 | handleToggle (feature, isOn) {
73 | if (isOn) {
74 | this.setState({
75 | activeName: feature.properties.name,
76 | bbox: bbox(feature)
77 | })
78 | } else {
79 | this.setState({
80 | activeName: null,
81 | bbox: mapOptions.bbox
82 | })
83 | }
84 | }
85 |
86 | render () {
87 | return (
88 |
89 |
90 |
142 |
148 |
149 |
150 | )
151 | }
152 | }
153 |
154 | export default Example
155 | ```
156 |
157 | - - -
158 |
159 | #### Developed by [TerraEclipse](https://github.com/TerraEclipse)
160 |
161 | Terra Eclipse, Inc. is a nationally recognized political technology and
162 | strategy firm located in Santa Cruz, CA and Washington, D.C.
163 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | @react-mapboxgl
2 | ===============
3 |
4 | About
5 | -----
6 |
7 | This aims to be as close of a 1-to-1 mapping of the `mapbox-gl-js` API to react as possible. It takes the largely imperative `mapbox-gl-js` codebase and wraps it in declarative react components. A few goals:
8 |
9 | - Declarative way to create mapbox-gl maps.
10 | - Support as close to 100% of the `mapbox-gl-js` API as makes sense.
11 | - Leverage the `mapbox-gl-js` way of doing things wherever possible.
12 | - "Everything is a component"
13 | - You should be able to do thinks like render layers, bind click handlers,
14 | respond to hovering over layers, ect. by merely rendering components.
15 | - Many maps will only need a render method, no state to juggle.
16 | - The core attempts to split things out to composable components wherever possible.
17 |
18 | Inspired and bootstrapped from [react-mapbox-gl](https://github.com/alex3165/react-mapbox-gl).
19 |
20 | Installation
21 | ------------
22 |
23 | Currently, this module needs to be bundled by *your* app. If you are already
24 | using something like webpack or rollup, you should be good to go. It requires
25 | installing some peer dependencies. I chose this to avoid increasing the
26 | bundle size if you're already using some of these libraries.
27 |
28 | ```sh
29 | $ npm install --save @react-mapboxgl/core mapbox-gl lodash react prop-types
30 | ```
31 |
32 | Documentation
33 | -------------
34 |
35 | Documentation and examples can be found in the [storybook](https://terraeclipse.github.io/react-mapboxgl).
36 |
37 | Sandbox
38 | -------
39 |
40 | You can easily play around with maps on codesandbox.io:
41 |
42 | [](https://codesandbox.io/s/E9p5AG5X0?hidenavigation=1)
43 |
44 |
45 | Quick Example
46 | -------------
47 |
48 | This renders a map, adds a source and layer to the map, and changes the fill
49 | of polygon features when they are hovered. See it in action [in the storybook](https://terraeclipse.github.io/react-mapboxgl/?selectedKind=Hover&selectedStory=Example&full=0&down=0).
50 |
51 | 
52 |
53 | ```js
54 | import React from 'react'
55 | import {MapboxProvider, MapGL, Source, Layer} from '@react-mapboxgl/core'
56 | import Hover from '@react-mapboxgl/hover'
57 |
58 | const mapOptions = {
59 | style: 'mapbox://styles/mapbox/streets-v9',
60 | bbox: [[-123.881836, 25.063209], [-65.170898, 48.848451]],
61 | center: [-95.844727, 39.620499],
62 | zoom: 3,
63 | padding: 30,
64 | containerStyle: {
65 | position: 'fixed',
66 | top: 0,
67 | left: 0,
68 | right: 0,
69 | bottom: 0,
70 | zIndex: 1
71 | }
72 | }
73 |
74 | const ExampleMap = () => {
75 | return (
76 |
77 |
78 | {/* Source to be used by layers (U.S. state polygons) */}
79 |
84 |
85 | {/* State fill layer */}
86 |
95 |
96 | {/* State borders layer */}
97 |
106 |
107 | {/* Declarative handler for hovering a layer's features.
108 |
109 | This component optionally allows a function as the
110 | *children*, similar to how libraries like react-motion do. You can
111 | leverage that to filter layers or otherwise modify them.
112 |
113 | The *property* should be a member of `feature.properties` that
114 | uniquely identifies each feature.
115 | */}
116 |
117 | {({properties: names}) => (
118 |
132 | )}
133 |
134 |
135 |
136 | )
137 | }
138 |
139 | export default ExampleMap
140 | ```
141 |
142 | - - -
143 |
144 | #### Developed by [TerraEclipse](https://github.com/TerraEclipse)
145 |
146 | Terra Eclipse, Inc. is a nationally recognized political technology and
147 | strategy firm located in Santa Cruz, CA and Washington, D.C.
148 |
--------------------------------------------------------------------------------
/modules/core/src/MapPosition.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import _ from 'lodash'
4 |
5 | class MapPosition extends React.Component {
6 | static propTypes = {
7 | // Map position options.
8 | center: PropTypes.oneOfType([
9 | PropTypes.arrayOf(PropTypes.number),
10 | PropTypes.object
11 | ]),
12 | zoom: PropTypes.number,
13 | minZoom: PropTypes.number,
14 | maxZoom: PropTypes.number,
15 | maxBounds: PropTypes.oneOfType([
16 | PropTypes.array,
17 | PropTypes.object
18 | ]),
19 | bearing: PropTypes.number,
20 | pitch: PropTypes.number,
21 |
22 | // Custom position options.
23 | bbox: PropTypes.oneOfType([
24 | PropTypes.array,
25 | PropTypes.object
26 | ]),
27 | padding: PropTypes.oneOfType([
28 | PropTypes.number,
29 | PropTypes.object
30 | ]),
31 | moveMethod: PropTypes.oneOf([
32 | 'jumpTo',
33 | 'easeTo',
34 | 'flyTo'
35 | ]),
36 | moveAround: PropTypes.array,
37 | moveAnimationOptions: PropTypes.object,
38 | moveFlyToOptions: PropTypes.object,
39 |
40 | // The positionRev provides a way to 'hard reset' the map
41 | // position. For example, if you want to reset the position to the
42 | // original props values (without changing the props values). An easy
43 | // way to use this would be to set it to a timestamp.
44 | positionRev: PropTypes.number
45 | }
46 |
47 | static defaultProps = {
48 | // Default map options.
49 | center: [
50 | -0.2416815,
51 | 51.5285582
52 | ],
53 | zoom: 11,
54 | minZoom: 0,
55 | maxZoom: 20,
56 | bearing: 0,
57 | pitch: 0,
58 |
59 | // Default custom options.
60 | moveMethod: 'flyTo',
61 | moveAnimationOptions: {},
62 | moveFlyToOptions: {},
63 | positionRev: 0
64 | }
65 |
66 | static contextTypes = {
67 | map: PropTypes.object
68 | }
69 |
70 | // Called when the map is initally created.
71 | static getOptions (props) {
72 | let pickFrom = _.defaults({}, props, MapPosition.defaultProps)
73 | let picked = _.pick(pickFrom, _.keys(MapPosition.propTypes))
74 | return _.omit(picked, [
75 | 'bbox',
76 | 'padding',
77 | 'moveMethod',
78 | 'moveAround',
79 | 'moveAnimationOptions',
80 | 'moveFlyToOptions',
81 | 'positionRev'
82 | ])
83 | }
84 |
85 | shouldComponentUpdate (nextProps, nextState) {
86 | return (
87 | !_.isEqual(this.props, nextProps) ||
88 | !_.isEqual(this.state, nextState)
89 | )
90 | }
91 |
92 | componentDidMount () {
93 | let {map} = this.context
94 | if (this.props.bbox) {
95 | map.fitBounds(this.props.bbox, {
96 | padding: this.props.padding || 0,
97 | duration: 0
98 | })
99 | }
100 | }
101 |
102 | componentWillReceiveProps (nextProps) {
103 | const {map} = this.context
104 |
105 | const didCenterUpdate = !_.isEqual(this.props.center, nextProps.center)
106 | const didZoomUpdate = this.props.zoom !== nextProps.zoom
107 | const didBearingUpdate = this.props.bearing !== nextProps.bearing
108 | const didPitchUpdate = this.props.pitch !== nextProps.pitch
109 | let cameraOptions = null
110 |
111 | // Position props changed.
112 | if (didZoomUpdate || didCenterUpdate || didBearingUpdate || didPitchUpdate) {
113 | cameraOptions = {
114 | center: didCenterUpdate ? nextProps.center : map.getCenter(),
115 | zoom: didZoomUpdate ? nextProps.zoom : map.getZoom(),
116 | bearing: didBearingUpdate ? nextProps.bearing : map.getBearing(),
117 | pitch: didPitchUpdate ? nextProps.pitch : map.getPitch(),
118 | around: nextProps.moveAround
119 | }
120 | }
121 |
122 | // PositionRev changed.
123 | if (this.props.positionRev !== nextProps.positionRev) {
124 | cameraOptions = {
125 | center: !_.isUndefined(nextProps.center) ? nextProps.center : map.getCenter(),
126 | zoom: !_.isUndefined(nextProps.zoom) ? nextProps.zoom : map.getZoom(),
127 | bearing: !_.isUndefined(nextProps.bearing) ? nextProps.bearing : map.getBearing(),
128 | pitch: !_.isUndefined(nextProps.pitch) ? nextProps.pitch : map.getPitch(),
129 | around: nextProps.moveAround
130 | }
131 | }
132 |
133 | if (cameraOptions) {
134 | map[nextProps.moveMethod](_.extend(
135 | cameraOptions,
136 | nextProps.moveMethod !== 'jumpTo'
137 | ? nextProps.moveAnimationOptions
138 | : {},
139 | nextProps.moveMethod === 'flyTo'
140 | ? nextProps.moveFlyToOptions
141 | : {}
142 | ))
143 | }
144 |
145 | if (!_.isEqual(this.props.bbox, nextProps.bbox)) {
146 | map.fitBounds(nextProps.bbox, _.extend(
147 | {
148 | padding: nextProps.padding || 0,
149 | linear: nextProps.moveMethod !== 'flyTo'
150 | },
151 | nextProps.moveAnimationOptions
152 | ? nextProps.moveAnimationOptions
153 | : {},
154 | nextProps.moveMethod === 'flyTo'
155 | ? nextProps.moveFlyToOptions
156 | : {}
157 | ))
158 | }
159 | }
160 |
161 | render () {
162 | return null
163 | }
164 | }
165 |
166 | export default MapPosition
167 |
--------------------------------------------------------------------------------
/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/button-layer/src/ButtonLayer.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PropTypes from 'prop-types'
3 | import _ from 'lodash'
4 | import union from '@turf/union'
5 | import {Children, Layer, LayerEvents, Source} from '@react-mapboxgl/core'
6 | import Click from '@react-mapboxgl/click'
7 | import Hover from '@react-mapboxgl/hover'
8 |
9 | class ButtonLayer extends React.Component {
10 | static propTypes = {
11 | id: PropTypes.string.isRequired,
12 | property: PropTypes.string,
13 |
14 | // Source
15 | source: PropTypes.oneOfType([
16 | PropTypes.string,
17 | PropTypes.object
18 | ]).isRequired,
19 | sourceLayer: PropTypes.string,
20 |
21 | // Layers
22 | base: PropTypes.object.isRequired,
23 | border: PropTypes.object,
24 | hover: PropTypes.object,
25 | hoverBorder: PropTypes.object,
26 | cluster: PropTypes.object,
27 | clusterBorder: PropTypes.object,
28 | clusterLabel: PropTypes.object,
29 | active: PropTypes.object,
30 | activeBorder: PropTypes.object,
31 | activeProperty: PropTypes.oneOfType([
32 | PropTypes.string,
33 | PropTypes.number,
34 | PropTypes.bool
35 | ]),
36 |
37 | // Hover
38 | hoverMode: PropTypes.string, // Either 'auto' or 'filter'.
39 | cursor: PropTypes.string,
40 | onHoverOver: PropTypes.func,
41 | onHoverOut: PropTypes.func,
42 |
43 | // Click
44 | clickEvent: PropTypes.string,
45 | avoidDoubleClick: PropTypes.bool,
46 | doubleClickSpeed: PropTypes.number,
47 | onClick: PropTypes.func
48 |
49 | // LayerEvents (bound to base layer)
50 | }
51 |
52 | static defaultProps = {
53 | hoverMode: 'auto'
54 | }
55 |
56 | static contextTypes = {
57 | map: PropTypes.object
58 | }
59 |
60 | constructor () {
61 | super()
62 | this.renderHoverChildren = this.renderHoverChildren.bind(this)
63 | }
64 |
65 | unionFeatures (features) {
66 | try {
67 | let result = []
68 | result.push(features.reduce((joined, next) => {
69 | if (joined.geometry.type === 'Polygon' || joined.geometry.type === 'MultiPolygon') {
70 | if (next.geometry.type === 'Polygon' || next.geometry.type === 'MultiPolygon') {
71 | return union(joined, next)
72 | } else {
73 | result.push(next)
74 | return joined
75 | }
76 | } else {
77 | result.push(joined)
78 | return next
79 | }
80 | }))
81 | return result
82 | } catch (e) {
83 | console.warn('Error detected when trying to union hovered features.')
84 | console.warn(e)
85 | return features
86 | }
87 | }
88 |
89 | renderHoverChildren ({properties}) {
90 | let {map} = this.context
91 | let {
92 | id, source, sourceLayer, property, base,
93 | hoverMode, hover, hoverBorder
94 | } = this.props
95 |
96 | let sourceId = (typeof source === 'string')
97 | ? source
98 | : (source.id || `${id}-source`)
99 | let sourceDef = map.getSource(sourceId)
100 | let sourceType = sourceDef && sourceDef.type
101 |
102 | // If we don't have a sourceType yet, render nothing.
103 | if (!sourceType) {
104 | return null
105 | }
106 |
107 | // For GeoJSON we change the data on a hover .
108 | if (hoverMode !== 'filter' && sourceType === 'geojson') {
109 | let features = []
110 | if (properties.length) {
111 | features = this.unionFeatures(map.querySourceFeatures(sourceId, {
112 | filter: ['in', property, ...properties]
113 | }))
114 | }
115 | return (
116 |
117 | {(hover || hoverBorder) ? (
118 |
123 | ) : null}
124 |
125 | {hover ? (
126 |
130 | ) : null}
131 |
132 | {hoverBorder ? (
133 |
137 | ) : null}
138 |
139 | )
140 | // For all other types, we use a filter on the layer.
141 | } else {
142 | return (
143 |
144 | {hover ? (
145 |
156 | ) : null}
157 |
158 | {hoverBorder ? (
159 |
170 | ) : null}
171 |
172 | )
173 | }
174 | }
175 |
176 | render () {
177 | let {
178 | id, source, sourceLayer, property,
179 | base, border, hover, hoverBorder,
180 | cluster, clusterBorder, clusterLabel,
181 | active, activeBorder, activeProperty,
182 | cursor, onHoverOver, onHoverOut,
183 | clickEvent, avoidDoubleClick, doubleClickSpeed, onClick
184 | } = this.props
185 |
186 | let sourceId = (typeof source === 'string')
187 | ? source
188 | : (source.id || `${id}-source`)
189 |
190 | return (
191 |
192 | {typeof source !== 'string' ? (
193 |
194 | ) : null}
195 |
196 |
207 |
208 | {onClick ? (
209 |
213 | ) : null}
214 |
215 | {border ? (
216 |
224 | ) : null}
225 |
226 | {(hover || hoverBorder || cursor || onHoverOver || onHoverOut) ? (
227 |
228 | {this.renderHoverChildren}
229 |
230 | ) : null}
231 |
232 | {cluster ? (
233 |
240 | ) : null}
241 |
242 | {clusterBorder ? (
243 |
250 | ) : null}
251 |
252 | {clusterLabel ? (
253 |
260 | ) : null}
261 |
262 | {active ? (
263 |
274 | ) : null}
275 |
276 | {activeBorder ? (
277 |
288 | ) : null}
289 |
290 | )
291 | }
292 | }
293 |
294 | export default ButtonLayer
295 |
--------------------------------------------------------------------------------
/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/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/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
--------------------------------------------------------------------------------