@opentripplanner/core-utils 14.3.0 → 14.3.1
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/__tests__/__mocks__/three-transfer-itinerary.json +2195 -0
- package/esm/itinerary.js +20 -25
- package/esm/itinerary.js.map +1 -1
- package/esm/three-transfer-itinerary.json +2195 -0
- package/lib/__tests__/__mocks__/three-transfer-itinerary.json +2195 -0
- package/lib/index.js +13 -42
- package/lib/index.js.map +1 -1
- package/lib/itinerary.d.ts.map +1 -1
- package/lib/itinerary.js +75 -134
- package/lib/itinerary.js.map +1 -1
- package/lib/map.js +11 -25
- package/lib/map.js.map +1 -1
- package/lib/query-gen.js +12 -21
- package/lib/query-gen.js.map +1 -1
- package/lib/route.d.ts.map +1 -1
- package/lib/route.js +26 -44
- package/lib/route.js.map +1 -1
- package/lib/storage.js +4 -11
- package/lib/storage.js.map +1 -1
- package/lib/suspense.d.ts.map +1 -1
- package/lib/suspense.js +3 -28
- package/lib/suspense.js.map +1 -1
- package/lib/time.d.ts.map +1 -1
- package/lib/time.js +20 -33
- package/lib/time.js.map +1 -1
- package/lib/ui.js +2 -7
- package/lib/ui.js.map +1 -1
- package/package.json +2 -2
- package/src/__snapshots__/core-utils.story.tsx.snap +1 -1
- package/src/__tests__/__mocks__/three-transfer-itinerary.json +2195 -0
- package/src/__tests__/itinerary.ts +9 -0
- package/src/itinerary.ts +21 -21
- package/tsconfig.tsbuildinfo +1 -1
package/lib/storage.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.randId = exports.removeItem = exports.getItem = exports.storeItem = void 0;
|
|
4
1
|
/* eslint-disable no-console */
|
|
5
2
|
// Prefix to use with local storage keys.
|
|
6
3
|
const STORAGE_PREFIX = "otp";
|
|
7
4
|
/**
|
|
8
5
|
* Store a javascript object at the specified key.
|
|
9
6
|
*/
|
|
10
|
-
function storeItem(key, object) {
|
|
7
|
+
export function storeItem(key, object) {
|
|
11
8
|
window.localStorage.setItem(`${STORAGE_PREFIX}.${key}`, JSON.stringify(object));
|
|
12
9
|
}
|
|
13
|
-
exports.storeItem = storeItem;
|
|
14
10
|
/**
|
|
15
11
|
* Retrieve a javascript object at the specified key. If not found, defaults to
|
|
16
12
|
* null or, the optionally provided notFoundValue.
|
|
17
13
|
*/
|
|
18
|
-
function getItem(key, notFoundValue = null) {
|
|
14
|
+
export function getItem(key, notFoundValue = null) {
|
|
19
15
|
let itemAsString;
|
|
20
16
|
try {
|
|
21
17
|
itemAsString = window.localStorage.getItem(`${STORAGE_PREFIX}.${key}`);
|
|
@@ -30,22 +26,19 @@ function getItem(key, notFoundValue = null) {
|
|
|
30
26
|
return notFoundValue;
|
|
31
27
|
}
|
|
32
28
|
}
|
|
33
|
-
exports.getItem = getItem;
|
|
34
29
|
/**
|
|
35
30
|
* Remove item at specified key.
|
|
36
31
|
*/
|
|
37
|
-
function removeItem(key) {
|
|
32
|
+
export function removeItem(key) {
|
|
38
33
|
window.localStorage.removeItem(`${STORAGE_PREFIX}.${key}`);
|
|
39
34
|
}
|
|
40
|
-
exports.removeItem = removeItem;
|
|
41
35
|
/**
|
|
42
36
|
* Generate a random ID. This might not quite be a UUID, but it serves our
|
|
43
37
|
* purposes for now.
|
|
44
38
|
*/
|
|
45
|
-
function randId() {
|
|
39
|
+
export function randId() {
|
|
46
40
|
return Math.random()
|
|
47
41
|
.toString(36)
|
|
48
42
|
.substr(2, 9);
|
|
49
43
|
}
|
|
50
|
-
exports.randId = randId;
|
|
51
44
|
//# sourceMappingURL=storage.js.map
|
package/lib/storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,+BAA+B;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Y,MAAM,OAAO,CAAC;AAEjE,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"suspense.d.ts","sourceRoot":"","sources":["../src/suspense.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEjE,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,YAAY,GAAI,wBAAwB,KAAK,KAAG,YASrD,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/lib/suspense.js
CHANGED
|
@@ -1,32 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const react_1 = __importStar(require("react"));
|
|
1
|
+
import React, { Suspense } from "react";
|
|
27
2
|
const SafeSuspense = ({ children, fallback }) => {
|
|
28
3
|
const IS_TEST_RUNNER = window.navigator.userAgent.match(/StorybookTestRunner/);
|
|
29
|
-
return IS_TEST_RUNNER ? (
|
|
4
|
+
return IS_TEST_RUNNER ? (React.createElement(React.Fragment, null, fallback)) : (React.createElement(Suspense, { fallback: fallback }, children));
|
|
30
5
|
};
|
|
31
|
-
|
|
6
|
+
export default SafeSuspense;
|
|
32
7
|
//# sourceMappingURL=suspense.js.map
|
package/lib/suspense.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suspense.js","sourceRoot":"","sources":["../src/suspense.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"suspense.js","sourceRoot":"","sources":["../src/suspense.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA2B,QAAQ,EAAE,MAAM,OAAO,CAAC;AAOjE,MAAM,YAAY,GAAG,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAS,EAAgB,EAAE;IACnE,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CACrD,qBAAqB,CACtB,CAAC;IACF,OAAO,cAAc,CAAC,CAAC,CAAC,CACtB,0CAAG,QAAQ,CAAI,CAChB,CAAC,CAAC,CAAC,CACF,oBAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,IAAG,QAAQ,CAAY,CACpD,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/lib/time.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAMhD,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAChD,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,GACd;IACD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAMA;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAMhD,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAChD,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,GACd;IACD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAMA;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,KAAG,MAC3B,CAAC;AAEhC;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,kBAAkB;AAClB,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD;AACD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAA,EAAE,OAAO,KAAA,OAErC;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,MAAM,CAGR;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,gBAAgB,SAAkB,GAAG,MAAM,CAG1E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,SAAoB,GAAG,MAAM,CAEnE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,SAAoB,GAAG,MAAM,CAEnE"}
|
package/lib/time.js
CHANGED
|
@@ -1,97 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getCurrentDate = exports.getCurrentTime = exports.getUserTimezone = exports.formatSecondsAfterMidnight = exports.offsetTime = exports.getLongDateFormat = exports.getDateFormat = exports.getTimeFormat = exports.ensureAtLeastOneMinute = exports.toHoursMinutesSeconds = exports.OTP_API_TIME_FORMAT = exports.OTP_API_DATE_FORMAT = void 0;
|
|
4
|
-
const date_fns_1 = require("date-fns");
|
|
5
|
-
const date_fns_tz_1 = require("date-fns-tz");
|
|
1
|
+
import { startOfDay, add, format } from "date-fns";
|
|
2
|
+
import { utcToZonedTime } from "date-fns-tz";
|
|
6
3
|
// Date/time formats (per date-fns) when sending/receiving date from OTP
|
|
7
4
|
// regardless of whatever the user has configured as the display format.
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const OTP_API_DATE_FORMAT = "yyyy-MM-dd";
|
|
6
|
+
export const OTP_API_TIME_FORMAT = "HH:mm";
|
|
10
7
|
/**
|
|
11
8
|
* Breaks up a duration in seconds into hours, minutes, and seconds.
|
|
12
9
|
* @param {number} seconds The number of seconds to break up
|
|
13
10
|
* @returns an object with fields with the corresponding, hours, minutes, seconds.
|
|
14
11
|
*/
|
|
15
|
-
function toHoursMinutesSeconds(seconds) {
|
|
12
|
+
export function toHoursMinutesSeconds(seconds) {
|
|
16
13
|
return {
|
|
17
14
|
hours: Math.floor(seconds / 3600),
|
|
18
15
|
minutes: Math.floor(seconds / 60) % 60,
|
|
19
16
|
seconds: seconds % 60
|
|
20
17
|
};
|
|
21
18
|
}
|
|
22
|
-
exports.toHoursMinutesSeconds = toHoursMinutesSeconds;
|
|
23
19
|
/**
|
|
24
20
|
* If a duration is less than 60 seconds, round it to one minute, to avoid a duration
|
|
25
21
|
* of 0 minutes on a leg.
|
|
26
22
|
* @param {number} duration The leg or trip duration in seconds
|
|
27
23
|
* @returns a duration in seconds of at least 60 seconds.
|
|
28
24
|
*/
|
|
29
|
-
const ensureAtLeastOneMinute = (duration) => duration < 60 ? 60 : duration;
|
|
30
|
-
exports.ensureAtLeastOneMinute = ensureAtLeastOneMinute;
|
|
25
|
+
export const ensureAtLeastOneMinute = (duration) => duration < 60 ? 60 : duration;
|
|
31
26
|
/**
|
|
32
27
|
* @param {[type]} config the OTP config object found in store
|
|
33
28
|
* @return {string} the config-defined time formatter or HH:mm (24-hr time)
|
|
34
29
|
*/
|
|
35
|
-
function getTimeFormat(config) {
|
|
30
|
+
export function getTimeFormat(config) {
|
|
36
31
|
var _a;
|
|
37
|
-
return ((_a = config === null || config === void 0 ? void 0 : config.dateTime) === null || _a === void 0 ? void 0 : _a.timeFormat) ||
|
|
32
|
+
return ((_a = config === null || config === void 0 ? void 0 : config.dateTime) === null || _a === void 0 ? void 0 : _a.timeFormat) || OTP_API_TIME_FORMAT;
|
|
38
33
|
}
|
|
39
|
-
|
|
40
|
-
function getDateFormat(config) {
|
|
34
|
+
export function getDateFormat(config) {
|
|
41
35
|
var _a;
|
|
42
|
-
return ((_a = config === null || config === void 0 ? void 0 : config.dateTime) === null || _a === void 0 ? void 0 : _a.dateFormat) ||
|
|
36
|
+
return ((_a = config === null || config === void 0 ? void 0 : config.dateTime) === null || _a === void 0 ? void 0 : _a.dateFormat) || OTP_API_DATE_FORMAT;
|
|
43
37
|
}
|
|
44
|
-
exports.getDateFormat = getDateFormat;
|
|
45
38
|
/** @deprecated */
|
|
46
|
-
function getLongDateFormat(config) {
|
|
39
|
+
export function getLongDateFormat(config) {
|
|
47
40
|
var _a;
|
|
48
41
|
return ((_a = config === null || config === void 0 ? void 0 : config.dateTime) === null || _a === void 0 ? void 0 : _a.longDateFormat) || "D MMMM YYYY";
|
|
49
42
|
}
|
|
50
|
-
exports.getLongDateFormat = getLongDateFormat;
|
|
51
43
|
/**
|
|
52
44
|
* Offsets a time according to the provided time options
|
|
53
45
|
* and returns the result.
|
|
54
46
|
*/
|
|
55
|
-
function offsetTime(ms, options) {
|
|
47
|
+
export function offsetTime(ms, options) {
|
|
56
48
|
return ms + ((options === null || options === void 0 ? void 0 : options.offset) || 0);
|
|
57
49
|
}
|
|
58
|
-
exports.offsetTime = offsetTime;
|
|
59
50
|
/**
|
|
60
51
|
* Formats a seconds after midnight value for display in narrative
|
|
61
52
|
* @param {number} seconds time since midnight in seconds
|
|
62
53
|
* @param {string} timeFormat A valid date-fns time format
|
|
63
54
|
* @return {string} formatted text representation
|
|
64
55
|
*/
|
|
65
|
-
function formatSecondsAfterMidnight(seconds, timeFormat) {
|
|
66
|
-
const time =
|
|
67
|
-
return
|
|
56
|
+
export function formatSecondsAfterMidnight(seconds, timeFormat) {
|
|
57
|
+
const time = add(startOfDay(new Date()), { seconds });
|
|
58
|
+
return format(time, timeFormat);
|
|
68
59
|
}
|
|
69
|
-
exports.formatSecondsAfterMidnight = formatSecondsAfterMidnight;
|
|
70
60
|
/**
|
|
71
61
|
* Uses Intl.DateTimeFormat() api to get the user's time zone. In a test
|
|
72
62
|
* environment, pulls timezone information from an env variable. Default to
|
|
73
63
|
* GMT+0 if the Intl API is unavailable.
|
|
74
64
|
*/
|
|
75
|
-
function getUserTimezone(fallbackTimezone = "Etc/Greenwich") {
|
|
65
|
+
export function getUserTimezone(fallbackTimezone = "Etc/Greenwich") {
|
|
76
66
|
if (process.env.NODE_ENV === "test")
|
|
77
67
|
return process.env.TZ;
|
|
78
68
|
return (Intl === null || Intl === void 0 ? void 0 : Intl.DateTimeFormat().resolvedOptions().timeZone) || fallbackTimezone;
|
|
79
69
|
}
|
|
80
|
-
exports.getUserTimezone = getUserTimezone;
|
|
81
70
|
/**
|
|
82
71
|
* Formats current time for use in OTP query
|
|
83
72
|
* The conversion to the user's timezone is needed for testing purposes.
|
|
84
73
|
*/
|
|
85
|
-
function getCurrentTime(timezone = getUserTimezone()) {
|
|
86
|
-
return
|
|
74
|
+
export function getCurrentTime(timezone = getUserTimezone()) {
|
|
75
|
+
return format(utcToZonedTime(Date.now(), timezone), OTP_API_TIME_FORMAT);
|
|
87
76
|
}
|
|
88
|
-
exports.getCurrentTime = getCurrentTime;
|
|
89
77
|
/**
|
|
90
78
|
* Formats current date for use in OTP query
|
|
91
79
|
* The conversion to the user's timezone is needed for testing purposes.
|
|
92
80
|
*/
|
|
93
|
-
function getCurrentDate(timezone = getUserTimezone()) {
|
|
94
|
-
return
|
|
81
|
+
export function getCurrentDate(timezone = getUserTimezone()) {
|
|
82
|
+
return format(utcToZonedTime(Date.now(), timezone), OTP_API_DATE_FORMAT);
|
|
95
83
|
}
|
|
96
|
-
exports.getCurrentDate = getCurrentDate;
|
|
97
84
|
//# sourceMappingURL=time.js.map
|
package/lib/time.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,wEAAwE;AACxE,wEAAwE;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC;AAChD,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAE3C;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAe;IAMf,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QACjC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,EAAE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AAK,MAAM;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;IAC3D,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,cAAc,GAAG,eAAe,GAAG,QAAQ,KAAI,gBAAgB,CAAC;AAC/E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,QAAQ,GAAG,eAAe,EAAE;IACzD,OAAO,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,EAAE,mBAAmB,CAAC,CAAC;AAC3E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,QAAQ,GAAG,eAAe,EAAE;IACzD,OAAO,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,EAAE,mBAAmB,CAAC,CAAC;AAC3E,CAAC"}
|
package/lib/ui.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enableScrollForSelector = exports.isMobile = void 0;
|
|
4
|
-
function isMobile() {
|
|
1
|
+
export function isMobile() {
|
|
5
2
|
// TODO: consider using 3rd-party library?
|
|
6
3
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
7
4
|
}
|
|
8
|
-
exports.isMobile = isMobile;
|
|
9
5
|
/**
|
|
10
6
|
* Enables scrolling for a specified selector, while disabling scrolling for all
|
|
11
7
|
* other targets. This is adapted from https://stackoverflow.com/a/41601290/915811
|
|
12
8
|
* and intended to fix issues with iOS elastic scrolling, e.g.,
|
|
13
9
|
* https://github.com/conveyal/trimet-mod-otp/issues/92.
|
|
14
10
|
*/
|
|
15
|
-
function enableScrollForSelector(selector) {
|
|
11
|
+
export function enableScrollForSelector(selector) {
|
|
16
12
|
const overlay = document.querySelector(selector);
|
|
17
13
|
let clientY = null; // remember Y position on touch start
|
|
18
14
|
function isOverlayTotallyScrolled() {
|
|
@@ -43,5 +39,4 @@ function enableScrollForSelector(selector) {
|
|
|
43
39
|
}
|
|
44
40
|
}, false);
|
|
45
41
|
}
|
|
46
|
-
exports.enableScrollForSelector = enableScrollForSelector;
|
|
47
42
|
//# sourceMappingURL=ui.js.map
|
package/lib/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ;IACtB,0CAA0C;IAC1C,OAAO,gEAAgE,CAAC,IAAI,CAC1E,SAAS,CAAC,SAAS,CACpB,CAAC;AACJ,CAAC;AACD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,OAAO,GAAG,IAAI,CAAC,CAAC,qCAAqC;IAEzD,SAAS,wBAAwB;QAC/B,+FAA+F;QAC/F,OAAO,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;IAC1E,CAAC;IAED,SAAS,iBAAiB,CAAC,KAAiB;QAC1C,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC;QAE9D,IAAI,OAAO,CAAC,SAAS,KAAK,CAAC,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YAChD,sCAAsC;YACtC,KAAK,CAAC,cAAc,EAAE,CAAC;QACzB,CAAC;QAED,IAAI,wBAAwB,EAAE,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACnD,sCAAsC;YACtC,KAAK,CAAC,cAAc,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,gBAAgB,CACtB,YAAY,EACZ,UAAS,KAAiB;QACxB,IAAI,KAAK,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,sBAAsB;YACtB,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC3C,CAAC;IACH,CAAC,EACD,KAAK,CACN,CAAC;IAEF,OAAO,CAAC,gBAAgB,CACtB,WAAW,EACX,UAAS,KAAiB;QACxB,IAAI,KAAK,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,sBAAsB;YACtB,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,EACD,KAAK,CACN,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentripplanner/core-utils",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.1",
|
|
4
4
|
"description": "Core functionality that is shared among numerous UI components",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=13"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"gitHead": "0af1b7cda60bd4252b219dcf893e01c2acb2ed5d",
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@opentripplanner/types": "8.3.
|
|
29
|
+
"@opentripplanner/types": "8.3.1"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"tsc": "tsc"
|