@opentripplanner/trip-viewer-overlay 1.1.0 → 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 CHANGED
@@ -1,29 +1,14 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
-
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
8
-
9
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
10
-
11
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
12
-
13
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/createClass";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
14
7
 
15
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
16
9
 
17
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
18
-
19
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
20
-
21
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; } }
22
11
 
23
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
24
-
25
- import coreUtils from "@opentripplanner/core-utils";
26
- import PropTypes from "prop-types";
27
12
  import React from "react";
28
13
  import { FeatureGroup, MapLayer, Polyline, withLeaflet } from "react-leaflet";
29
14
  import polyline from "@mapbox/polyline";
@@ -88,16 +73,16 @@ TripViewerOverlay.propTypes = {
88
73
  *
89
74
  * See https://leafletjs.com/reference-1.6.0.html#path
90
75
  */
91
- leafletPath: coreUtils.types.leafletPathType,
76
+ // leafletPath: coreUtils.types.leafletPathType,
92
77
 
93
78
  /**
94
79
  * This represents data about a trip as obtained from a transit index.
95
80
  * Typically a trip has more data than these items, so this is only a list of
96
81
  * the properties that this component actually uses.
97
82
  */
98
- tripData: PropTypes.shape({
99
- geometry: coreUtils.types.encodedPolylineType
100
- })
83
+ // tripData: PropTypes.shape({
84
+ // geometry: coreUtils.types.encodedPolylineType
85
+ // })
101
86
  };
102
87
  TripViewerOverlay.defaultProps = {
103
88
  leafletPath: {
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["coreUtils","PropTypes","React","FeatureGroup","MapLayer","Polyline","withLeaflet","polyline","TripViewerOverlay","prevProps","oldGeometry","tripData","geometry","newGeometry","props","pts","decode","points","leaflet","map","fitBounds","leafletPath","propTypes","types","leafletPathType","shape","encodedPolylineType","defaultProps","color","opacity","weight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,SAAP,MAAsB,6BAAtB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,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;AACED,EAAAA,WAAW,EAAErB,SAAS,CAACuB,KAAV,CAAgBC,eAPD;;AAQ5B;AACF;AACA;AACA;AACA;AACEb,EAAAA,QAAQ,EAAEV,SAAS,CAACwB,KAAV,CAAgB;AACxBb,IAAAA,QAAQ,EAAEZ,SAAS,CAACuB,KAAV,CAAgBG;AADF,GAAhB;AAbkB,CAA9B;AAkBAlB,iBAAiB,CAACmB,YAAlB,GAAiC;AAC/BN,EAAAA,WAAW,EAAE;AACXO,IAAAA,KAAK,EAAE,SADI;AAEXC,IAAAA,OAAO,EAAE,GAFE;AAGXC,IAAAA,MAAM,EAAE;AAHG;AADkB,CAAjC;AAQA,eAAexB,WAAW,CAACE,iBAAD,CAA1B","sourcesContent":["import coreUtils from \"@opentripplanner/core-utils\";\nimport PropTypes from \"prop-types\";\nimport 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"}
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
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.default = void 0;
7
9
 
8
- var _coreUtils = _interopRequireDefault(require("@opentripplanner/core-utils"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
12
12
  var _react = _interopRequireDefault(require("react"));
13
13
 
@@ -15,10 +15,6 @@ var _reactLeaflet = require("react-leaflet");
15
15
 
16
16
  var _polyline = _interopRequireDefault(require("@mapbox/polyline"));
17
17
 
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
-
22
18
  /**
23
19
  * An overlay that will display the geometry of a trip.
24
20
  */
@@ -51,7 +47,7 @@ class TripViewerOverlay extends _reactLeaflet.MapLayer {
51
47
 
52
48
  const pts = _polyline.default.decode(tripData.geometry.points);
53
49
 
54
- return /*#__PURE__*/_react.default.createElement(_reactLeaflet.FeatureGroup, null, /*#__PURE__*/_react.default.createElement(_reactLeaflet.Polyline, _extends({}, leafletPath, {
50
+ return /*#__PURE__*/_react.default.createElement(_reactLeaflet.FeatureGroup, null, /*#__PURE__*/_react.default.createElement(_reactLeaflet.Polyline, (0, _extends2.default)({}, leafletPath, {
55
51
  positions: pts
56
52
  })));
57
53
  }
@@ -65,16 +61,16 @@ TripViewerOverlay.propTypes = {
65
61
  *
66
62
  * See https://leafletjs.com/reference-1.6.0.html#path
67
63
  */
68
- leafletPath: _coreUtils.default.types.leafletPathType,
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: _propTypes.default.shape({
76
- geometry: _coreUtils.default.types.encodedPolylineType
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","coreUtils","types","leafletPathType","PropTypes","shape","encodedPolylineType","defaultProps","color","opacity","weight"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;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,eAAcO,WAAd;AAA2B,MAAA,SAAS,EAAEV;AAAtC,OAFF,CADF;AAMD;;AA9BsC;;AAiCzCX,iBAAiB,CAACsB,SAAlB,GAA8B;AAC5B;AACF;AACA;AACA;AACA;AACA;AACED,EAAAA,WAAW,EAAEE,mBAAUC,KAAV,CAAgBC,eAPD;;AAQ5B;AACF;AACA;AACA;AACA;AACElB,EAAAA,QAAQ,EAAEmB,mBAAUC,KAAV,CAAgB;AACxBnB,IAAAA,QAAQ,EAAEe,mBAAUC,KAAV,CAAgBI;AADF,GAAhB;AAbkB,CAA9B;AAkBA5B,iBAAiB,CAAC6B,YAAlB,GAAiC;AAC/BR,EAAAA,WAAW,EAAE;AACXS,IAAAA,KAAK,EAAE,SADI;AAEXC,IAAAA,OAAO,EAAE,GAFE;AAGXC,IAAAA,MAAM,EAAE;AAHG;AADkB,CAAjC;;eAQe,+BAAYhC,iBAAZ,C","sourcesContent":["import coreUtils from \"@opentripplanner/core-utils\";\nimport PropTypes from \"prop-types\";\nimport 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"}
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.0",
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,12 +19,12 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@mapbox/polyline": "^1.1.0",
22
- "@opentripplanner/core-utils": "^3.0.4",
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": "^1.0.4",
27
- "react": "^16.8.6",
26
+ "@opentripplanner/base-map": "^2.0.0",
27
+ "react": "^16.14.0",
28
28
  "react-leaflet": "^2.6.1"
29
29
  },
30
30
  "gitHead": "0af1b7cda60bd4252b219dcf893e01c2acb2ed5d"
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
- geometry: coreUtils.types.encodedPolylineType
59
- })
55
+ // tripData: PropTypes.shape({
56
+ // geometry: coreUtils.types.encodedPolylineType
57
+ // })
60
58
  };
61
59
 
62
60
  TripViewerOverlay.defaultProps = {