@opentripplanner/trip-viewer-overlay 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.js +4 -6
- package/esm/index.js.map +1 -1
- package/lib/index.js +4 -8
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.js +4 -6
package/esm/index.js
CHANGED
|
@@ -9,8 +9,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
9
9
|
|
|
10
10
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
11
|
|
|
12
|
-
import coreUtils from "@opentripplanner/core-utils";
|
|
13
|
-
import PropTypes from "prop-types";
|
|
14
12
|
import React from "react";
|
|
15
13
|
import { FeatureGroup, MapLayer, Polyline, withLeaflet } from "react-leaflet";
|
|
16
14
|
import polyline from "@mapbox/polyline";
|
|
@@ -75,16 +73,16 @@ TripViewerOverlay.propTypes = {
|
|
|
75
73
|
*
|
|
76
74
|
* See https://leafletjs.com/reference-1.6.0.html#path
|
|
77
75
|
*/
|
|
78
|
-
leafletPath: coreUtils.types.leafletPathType,
|
|
76
|
+
// leafletPath: coreUtils.types.leafletPathType,
|
|
79
77
|
|
|
80
78
|
/**
|
|
81
79
|
* This represents data about a trip as obtained from a transit index.
|
|
82
80
|
* Typically a trip has more data than these items, so this is only a list of
|
|
83
81
|
* the properties that this component actually uses.
|
|
84
82
|
*/
|
|
85
|
-
tripData: PropTypes.shape({
|
|
86
|
-
|
|
87
|
-
})
|
|
83
|
+
// tripData: PropTypes.shape({
|
|
84
|
+
// geometry: coreUtils.types.encodedPolylineType
|
|
85
|
+
// })
|
|
88
86
|
};
|
|
89
87
|
TripViewerOverlay.defaultProps = {
|
|
90
88
|
leafletPath: {
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["React","FeatureGroup","MapLayer","Polyline","withLeaflet","polyline","TripViewerOverlay","prevProps","oldGeometry","tripData","geometry","newGeometry","props","pts","decode","points","leaflet","map","fitBounds","leafletPath","propTypes","defaultProps","color","opacity","weight"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,YAAT,EAAuBC,QAAvB,EAAiCC,QAAjC,EAA2CC,WAA3C,QAA8D,eAA9D;AAEA,OAAOC,QAAP,MAAqB,kBAArB;AAEA;AACA;AACA;;IACMC,iB;;;;;;;;;;;;;WACJ,6BAAoB,CAAE,C,CAEtB;;;;WACA,gCAAuB,CAAE;;;WAEzB,4BAAmBC,SAAnB,EAA8B;AAC5B,UAAMC,WAAW,GAAGD,SAAS,CAACE,QAAV,IAAsBF,SAAS,CAACE,QAAV,CAAmBC,QAA7D;AACA,UAAMC,WAAW,GAAG,KAAKC,KAAL,CAAWH,QAAX,IAAuB,KAAKG,KAAL,CAAWH,QAAX,CAAoBC,QAA/D;AACA,UAAIF,WAAW,KAAKG,WAAhB,IAA+B,CAACA,WAApC,EAAiD;AACjD,UAAME,GAAG,GAAGR,QAAQ,CAACS,MAAT,CAAgBH,WAAW,CAACI,MAA5B,CAAZ;AACA,WAAKH,KAAL,CAAWI,OAAX,CAAmBC,GAAnB,CAAuBC,SAAvB,CAAiCL,GAAjC;AACD;;;WAED,gCAAuB,CAAE;;;WAEzB,gCAAuB,CAAE;;;WAEzB,kBAAS;AACP,wBAAkC,KAAKD,KAAvC;AAAA,UAAQO,WAAR,eAAQA,WAAR;AAAA,UAAqBV,QAArB,eAAqBA,QAArB;AAEA,UAAI,CAACA,QAAD,IAAa,CAACA,QAAQ,CAACC,QAA3B,EAAqC,oBAAO,oBAAC,YAAD,OAAP;AAErC,UAAMG,GAAG,GAAGR,QAAQ,CAACS,MAAT,CAAgBL,QAAQ,CAACC,QAAT,CAAkBK,MAAlC,CAAZ;AACA,0BACE,oBAAC,YAAD,qBAEE,oBAAC,QAAD,eAAcI,WAAd;AAA2B,QAAA,SAAS,EAAEN;AAAtC,SAFF,CADF;AAMD;;;;EA9B6BX,Q;;AAiChCI,iBAAiB,CAACc,SAAlB,GAA8B;AAC5B;AACF;AACA;AACA;AACA;AACA;AACE;;AACA;AACF;AACA;AACA;AACA;AACE;AACA;AACA;AAf4B,CAA9B;AAkBAd,iBAAiB,CAACe,YAAlB,GAAiC;AAC/BF,EAAAA,WAAW,EAAE;AACXG,IAAAA,KAAK,EAAE,SADI;AAEXC,IAAAA,OAAO,EAAE,GAFE;AAGXC,IAAAA,MAAM,EAAE;AAHG;AADkB,CAAjC;AAQA,eAAepB,WAAW,CAACE,iBAAD,CAA1B","sourcesContent":["import React from \"react\";\nimport { FeatureGroup, MapLayer, Polyline, withLeaflet } from \"react-leaflet\";\n\nimport polyline from \"@mapbox/polyline\";\n\n/**\n * An overlay that will display the geometry of a trip.\n */\nclass TripViewerOverlay extends MapLayer {\n componentDidMount() {}\n\n // TODO: determine why the default MapLayer componentWillUnmount() method throws an error\n componentWillUnmount() {}\n\n componentDidUpdate(prevProps) {\n const oldGeometry = prevProps.tripData && prevProps.tripData.geometry;\n const newGeometry = this.props.tripData && this.props.tripData.geometry;\n if (oldGeometry === newGeometry || !newGeometry) return;\n const pts = polyline.decode(newGeometry.points);\n this.props.leaflet.map.fitBounds(pts);\n }\n\n createLeafletElement() {}\n\n updateLeafletElement() {}\n\n render() {\n const { leafletPath, tripData } = this.props;\n\n if (!tripData || !tripData.geometry) return <FeatureGroup />;\n\n const pts = polyline.decode(tripData.geometry.points);\n return (\n <FeatureGroup>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <Polyline {...leafletPath} positions={pts} />\n </FeatureGroup>\n );\n }\n}\n\nTripViewerOverlay.propTypes = {\n /**\n * Leaflet path properties to use to style the polyline that represents the\n * trip.\n *\n * See https://leafletjs.com/reference-1.6.0.html#path\n */\n // leafletPath: coreUtils.types.leafletPathType,\n /**\n * This represents data about a trip as obtained from a transit index.\n * Typically a trip has more data than these items, so this is only a list of\n * the properties that this component actually uses.\n */\n // tripData: PropTypes.shape({\n // geometry: coreUtils.types.encodedPolylineType\n // })\n};\n\nTripViewerOverlay.defaultProps = {\n leafletPath: {\n color: \"#00bfff\",\n opacity: 0.6,\n weight: 8\n }\n};\n\nexport default withLeaflet(TripViewerOverlay);\n"],"file":"index.js"}
|
package/lib/index.js
CHANGED
|
@@ -9,10 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
12
|
-
var _coreUtils = _interopRequireDefault(require("@opentripplanner/core-utils"));
|
|
13
|
-
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
12
|
var _react = _interopRequireDefault(require("react"));
|
|
17
13
|
|
|
18
14
|
var _reactLeaflet = require("react-leaflet");
|
|
@@ -65,16 +61,16 @@ TripViewerOverlay.propTypes = {
|
|
|
65
61
|
*
|
|
66
62
|
* See https://leafletjs.com/reference-1.6.0.html#path
|
|
67
63
|
*/
|
|
68
|
-
leafletPath:
|
|
64
|
+
// leafletPath: coreUtils.types.leafletPathType,
|
|
69
65
|
|
|
70
66
|
/**
|
|
71
67
|
* This represents data about a trip as obtained from a transit index.
|
|
72
68
|
* Typically a trip has more data than these items, so this is only a list of
|
|
73
69
|
* the properties that this component actually uses.
|
|
74
70
|
*/
|
|
75
|
-
tripData:
|
|
76
|
-
|
|
77
|
-
})
|
|
71
|
+
// tripData: PropTypes.shape({
|
|
72
|
+
// geometry: coreUtils.types.encodedPolylineType
|
|
73
|
+
// })
|
|
78
74
|
};
|
|
79
75
|
TripViewerOverlay.defaultProps = {
|
|
80
76
|
leafletPath: {
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["TripViewerOverlay","MapLayer","componentDidMount","componentWillUnmount","componentDidUpdate","prevProps","oldGeometry","tripData","geometry","newGeometry","props","pts","polyline","decode","points","leaflet","map","fitBounds","createLeafletElement","updateLeafletElement","render","leafletPath","propTypes","
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["TripViewerOverlay","MapLayer","componentDidMount","componentWillUnmount","componentDidUpdate","prevProps","oldGeometry","tripData","geometry","newGeometry","props","pts","polyline","decode","points","leaflet","map","fitBounds","createLeafletElement","updateLeafletElement","render","leafletPath","propTypes","defaultProps","color","opacity","weight"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA;;AAEA;AACA;AACA;AACA,MAAMA,iBAAN,SAAgCC,sBAAhC,CAAyC;AACvCC,EAAAA,iBAAiB,GAAG,CAAE,CADiB,CAGvC;;;AACAC,EAAAA,oBAAoB,GAAG,CAAE;;AAEzBC,EAAAA,kBAAkB,CAACC,SAAD,EAAY;AAC5B,UAAMC,WAAW,GAAGD,SAAS,CAACE,QAAV,IAAsBF,SAAS,CAACE,QAAV,CAAmBC,QAA7D;AACA,UAAMC,WAAW,GAAG,KAAKC,KAAL,CAAWH,QAAX,IAAuB,KAAKG,KAAL,CAAWH,QAAX,CAAoBC,QAA/D;AACA,QAAIF,WAAW,KAAKG,WAAhB,IAA+B,CAACA,WAApC,EAAiD;;AACjD,UAAME,GAAG,GAAGC,kBAASC,MAAT,CAAgBJ,WAAW,CAACK,MAA5B,CAAZ;;AACA,SAAKJ,KAAL,CAAWK,OAAX,CAAmBC,GAAnB,CAAuBC,SAAvB,CAAiCN,GAAjC;AACD;;AAEDO,EAAAA,oBAAoB,GAAG,CAAE;;AAEzBC,EAAAA,oBAAoB,GAAG,CAAE;;AAEzBC,EAAAA,MAAM,GAAG;AACP,UAAM;AAAEC,MAAAA,WAAF;AAAed,MAAAA;AAAf,QAA4B,KAAKG,KAAvC;AAEA,QAAI,CAACH,QAAD,IAAa,CAACA,QAAQ,CAACC,QAA3B,EAAqC,oBAAO,6BAAC,0BAAD,OAAP;;AAErC,UAAMG,GAAG,GAAGC,kBAASC,MAAT,CAAgBN,QAAQ,CAACC,QAAT,CAAkBM,MAAlC,CAAZ;;AACA,wBACE,6BAAC,0BAAD,qBAEE,6BAAC,sBAAD,6BAAcO,WAAd;AAA2B,MAAA,SAAS,EAAEV;AAAtC,OAFF,CADF;AAMD;;AA9BsC;;AAiCzCX,iBAAiB,CAACsB,SAAlB,GAA8B;AAC5B;AACF;AACA;AACA;AACA;AACA;AACE;;AACA;AACF;AACA;AACA;AACA;AACE;AACA;AACA;AAf4B,CAA9B;AAkBAtB,iBAAiB,CAACuB,YAAlB,GAAiC;AAC/BF,EAAAA,WAAW,EAAE;AACXG,IAAAA,KAAK,EAAE,SADI;AAEXC,IAAAA,OAAO,EAAE,GAFE;AAGXC,IAAAA,MAAM,EAAE;AAHG;AADkB,CAAjC;;eAQe,+BAAY1B,iBAAZ,C","sourcesContent":["import React from \"react\";\nimport { FeatureGroup, MapLayer, Polyline, withLeaflet } from \"react-leaflet\";\n\nimport polyline from \"@mapbox/polyline\";\n\n/**\n * An overlay that will display the geometry of a trip.\n */\nclass TripViewerOverlay extends MapLayer {\n componentDidMount() {}\n\n // TODO: determine why the default MapLayer componentWillUnmount() method throws an error\n componentWillUnmount() {}\n\n componentDidUpdate(prevProps) {\n const oldGeometry = prevProps.tripData && prevProps.tripData.geometry;\n const newGeometry = this.props.tripData && this.props.tripData.geometry;\n if (oldGeometry === newGeometry || !newGeometry) return;\n const pts = polyline.decode(newGeometry.points);\n this.props.leaflet.map.fitBounds(pts);\n }\n\n createLeafletElement() {}\n\n updateLeafletElement() {}\n\n render() {\n const { leafletPath, tripData } = this.props;\n\n if (!tripData || !tripData.geometry) return <FeatureGroup />;\n\n const pts = polyline.decode(tripData.geometry.points);\n return (\n <FeatureGroup>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <Polyline {...leafletPath} positions={pts} />\n </FeatureGroup>\n );\n }\n}\n\nTripViewerOverlay.propTypes = {\n /**\n * Leaflet path properties to use to style the polyline that represents the\n * trip.\n *\n * See https://leafletjs.com/reference-1.6.0.html#path\n */\n // leafletPath: coreUtils.types.leafletPathType,\n /**\n * This represents data about a trip as obtained from a transit index.\n * Typically a trip has more data than these items, so this is only a list of\n * the properties that this component actually uses.\n */\n // tripData: PropTypes.shape({\n // geometry: coreUtils.types.encodedPolylineType\n // })\n};\n\nTripViewerOverlay.defaultProps = {\n leafletPath: {\n color: \"#00bfff\",\n opacity: 0.6,\n weight: 8\n }\n};\n\nexport default withLeaflet(TripViewerOverlay);\n"],"file":"index.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentripplanner/trip-viewer-overlay",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "A map overlay to show a trip of a route",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@mapbox/polyline": "^1.1.0",
|
|
22
|
-
"@opentripplanner/core-utils": "^
|
|
22
|
+
"@opentripplanner/core-utils": "^7.0.0-alpha.3",
|
|
23
23
|
"prop-types": "^15.7.2"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@opentripplanner/base-map": "^
|
|
26
|
+
"@opentripplanner/base-map": "^2.0.0",
|
|
27
27
|
"react": "^16.14.0",
|
|
28
28
|
"react-leaflet": "^2.6.1"
|
|
29
29
|
},
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import coreUtils from "@opentripplanner/core-utils";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
1
|
import React from "react";
|
|
4
2
|
import { FeatureGroup, MapLayer, Polyline, withLeaflet } from "react-leaflet";
|
|
5
3
|
|
|
@@ -48,15 +46,15 @@ TripViewerOverlay.propTypes = {
|
|
|
48
46
|
*
|
|
49
47
|
* See https://leafletjs.com/reference-1.6.0.html#path
|
|
50
48
|
*/
|
|
51
|
-
leafletPath: coreUtils.types.leafletPathType,
|
|
49
|
+
// leafletPath: coreUtils.types.leafletPathType,
|
|
52
50
|
/**
|
|
53
51
|
* This represents data about a trip as obtained from a transit index.
|
|
54
52
|
* Typically a trip has more data than these items, so this is only a list of
|
|
55
53
|
* the properties that this component actually uses.
|
|
56
54
|
*/
|
|
57
|
-
tripData: PropTypes.shape({
|
|
58
|
-
|
|
59
|
-
})
|
|
55
|
+
// tripData: PropTypes.shape({
|
|
56
|
+
// geometry: coreUtils.types.encodedPolylineType
|
|
57
|
+
// })
|
|
60
58
|
};
|
|
61
59
|
|
|
62
60
|
TripViewerOverlay.defaultProps = {
|