atriusmaps-node-sdk 3.3.632 → 3.3.634
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/LICENSE.md +1 -2
- package/README.md +15 -16
- package/dist/cjs/deploy/prepareSDKConfig.js +73 -57
- package/dist/cjs/nodesdk/nodeEntry.js +51 -44
- package/dist/cjs/package.json.js +4 -1
- package/dist/cjs/plugins/clientAPI/src/clientAPI.js +6 -4
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +32 -26
- package/dist/cjs/plugins/dynamicPois/src/processors.js +41 -35
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +102 -95
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +52 -26
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +86 -66
- package/dist/cjs/plugins/searchService/src/flexsearchExports/lang.js +16 -16
- package/dist/cjs/plugins/searchService/src/flexsearchExports/simple.js +31 -8
- package/dist/cjs/plugins/searchService/src/poiSearch.js +14 -17
- package/dist/cjs/plugins/searchService/src/searchService.js +41 -39
- package/dist/cjs/plugins/searchService/src/searchTypeahead.js +14 -19
- package/dist/cjs/plugins/searchService/src/utils.js +4 -5
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +145 -127
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +37 -39
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +11 -18
- package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +18 -19
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +111 -91
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +19 -16
- package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +1 -1
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +79 -76
- package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +1 -1
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +147 -107
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +178 -148
- package/dist/cjs/src/app.js +64 -44
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +22 -21
- package/dist/cjs/src/configs/postproc-stateTracking.js +5 -8
- package/dist/cjs/src/controller.js +11 -6
- package/dist/cjs/src/debugTools.js +61 -34
- package/dist/cjs/src/env.js +7 -4
- package/dist/cjs/src/extModules/bustle.js +35 -45
- package/dist/cjs/src/extModules/flexapi/src/help.js +16 -8
- package/dist/cjs/src/extModules/flexapi/src/index.js +39 -18
- package/dist/cjs/src/extModules/flexapi/src/validate.js +129 -87
- package/dist/cjs/src/extModules/geohasher.js +7 -7
- package/dist/cjs/src/extModules/log.js +20 -22
- package/dist/cjs/src/historyManager.js +2 -2
- package/dist/cjs/src/utils/bounds.js +6 -6
- package/dist/cjs/src/utils/buildStructureLookup.js +3 -3
- package/dist/cjs/src/utils/configUtils.js +14 -18
- package/dist/cjs/src/utils/dom.js +12 -18
- package/dist/cjs/src/utils/funcs.js +12 -15
- package/dist/cjs/src/utils/geodesy.js +7 -9
- package/dist/cjs/src/utils/geom.js +52 -40
- package/dist/cjs/src/utils/i18n.js +47 -36
- package/dist/cjs/src/utils/location.js +12 -13
- package/dist/cjs/src/utils/observable.js +27 -28
- package/dist/cjs/src/utils/rand.js +9 -10
- package/dist/package.json.js +1 -1
- package/package.json +1 -1
package/dist/cjs/src/app.js
CHANGED
|
@@ -14,7 +14,7 @@ function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: nu
|
|
|
14
14
|
const isBrowser = typeof window !== 'undefined';
|
|
15
15
|
const TRACE = false;
|
|
16
16
|
|
|
17
|
-
async function setupPlugin
|
|
17
|
+
async function setupPlugin(app, id, config) {
|
|
18
18
|
let name = id;
|
|
19
19
|
if (name.includes('/')) {
|
|
20
20
|
const split = name.split('/');
|
|
@@ -22,17 +22,16 @@ async function setupPlugin (app, id, config) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (config.active !== undefined) {
|
|
25
|
-
if (
|
|
25
|
+
if (config.active === false || (config.active === 'notLocalhost' && app.env.isLocalhost())) {
|
|
26
26
|
app.log.info(`Plugin ${id} explicitly deativated`);
|
|
27
|
-
return null
|
|
27
|
+
return null;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
return import(`../plugins/${id}/src/${name}.js`)
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
})
|
|
31
|
+
return import(`../plugins/${id}/src/${name}.js`).then(pluginModule => {
|
|
32
|
+
app.log.info(`Creating plugin ${id}`);
|
|
33
|
+
return pluginModule.create(app, config);
|
|
34
|
+
});
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
// takes the `lang` query parameter and returns the most specific supported language
|
|
@@ -40,29 +39,43 @@ async function setupPlugin (app, id, config) {
|
|
|
40
39
|
// supportedLanguages : array of supported language strings. i.e. [ "en", "en-US", "fr", "ja" ]
|
|
41
40
|
// defaultLanguage : if all fails, use this language. default = "en"
|
|
42
41
|
const getLang = config => {
|
|
43
|
-
const supportedLanguages = config.supportedLanguages || [
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
const supportedLanguages = config.supportedLanguages || [
|
|
43
|
+
'ar',
|
|
44
|
+
'de',
|
|
45
|
+
'en',
|
|
46
|
+
'es',
|
|
47
|
+
'fr',
|
|
48
|
+
'hi',
|
|
49
|
+
'is',
|
|
50
|
+
'it',
|
|
51
|
+
'ja',
|
|
52
|
+
'ko',
|
|
53
|
+
'pl',
|
|
54
|
+
'pt',
|
|
55
|
+
'zh-Hans',
|
|
56
|
+
'zh-Hant',
|
|
57
|
+
'el-GR',
|
|
58
|
+
'th',
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
if (typeof window !== 'undefined') {
|
|
62
|
+
// if this is a browser...
|
|
46
63
|
const queryParms = new URLSearchParams(location.search);
|
|
47
64
|
// eslint-disable-next-line no-constant-condition
|
|
48
65
|
let lang = queryParms.get('lang') || (typeof navigator ? navigator.language : null);
|
|
49
66
|
while (lang)
|
|
50
|
-
if (lang && supportedLanguages.includes(lang))
|
|
51
|
-
|
|
52
|
-
else
|
|
53
|
-
lang = lang.substring(0, lang.lastIndexOf('-'));
|
|
67
|
+
if (lang && supportedLanguages.includes(lang)) return lang;
|
|
68
|
+
else lang = lang.substring(0, lang.lastIndexOf('-'));
|
|
54
69
|
}
|
|
55
70
|
|
|
56
|
-
return config.defaultLanguage || 'en'
|
|
71
|
+
return config.defaultLanguage || 'en';
|
|
57
72
|
};
|
|
58
73
|
|
|
59
|
-
async function loadConfig
|
|
60
|
-
return isBrowser
|
|
61
|
-
? import(`./configs/${name}.json`)
|
|
62
|
-
: import(`./configs/${name}.json.js`) // bit of a hack - but supports all versions of node. See https://gitlab.com/locuslabspublic/node-sdk/-/merge_requests/1
|
|
74
|
+
async function loadConfig(name) {
|
|
75
|
+
return isBrowser ? import(`./configs/${name}.json`) : import(`./configs/${name}.json.js`); // bit of a hack - but supports all versions of node. See https://gitlab.com/locuslabspublic/node-sdk/-/merge_requests/1
|
|
63
76
|
}
|
|
64
77
|
|
|
65
|
-
async function extendConfig
|
|
78
|
+
async function extendConfig(config, extendsConfigs) {
|
|
66
79
|
let newConfig = {};
|
|
67
80
|
const extConfigFiles = await Promise.all(extendsConfigs.map(loadConfig));
|
|
68
81
|
for (const extendsConfigMod of extConfigFiles) {
|
|
@@ -71,21 +84,17 @@ async function extendConfig (config, extendsConfigs) {
|
|
|
71
84
|
newConfig = R.mergeDeepRight(newConfig, extendsConfig); // default is JSON data in ES6 modules import
|
|
72
85
|
}
|
|
73
86
|
newConfig = R.mergeDeepRight(newConfig, config);
|
|
74
|
-
return newConfig
|
|
87
|
+
return newConfig;
|
|
75
88
|
}
|
|
76
89
|
|
|
77
90
|
// const isSimpleName = name => /^[-a-zA-Z0-9]+$/.test(name) // composed of only alphanumeric and dash
|
|
78
91
|
|
|
79
|
-
const createPostProcessor = name =>
|
|
80
|
-
config => import(`./configs/postproc-${name}.js`)
|
|
81
|
-
.then(pp => pp.process(config));
|
|
92
|
+
const createPostProcessor = name => config => import(`./configs/postproc-${name}.js`).then(pp => pp.process(config));
|
|
82
93
|
|
|
83
94
|
const handleConfigPostProcess = async config =>
|
|
84
|
-
config.configPostProc
|
|
85
|
-
? Zousan.series(config, ...config.configPostProc.map(createPostProcessor))
|
|
86
|
-
: config;
|
|
95
|
+
config.configPostProc ? Zousan.series(config, ...config.configPostProc.map(createPostProcessor)) : config;
|
|
87
96
|
|
|
88
|
-
async function create
|
|
97
|
+
async function create(rawConfig) {
|
|
89
98
|
const appInstance = Object.create(null);
|
|
90
99
|
|
|
91
100
|
let config = rawConfig.extends ? await extendConfig(rawConfig, rawConfig.extends) : rawConfig;
|
|
@@ -103,32 +112,43 @@ async function create (rawConfig) {
|
|
|
103
112
|
appInstance.config = config;
|
|
104
113
|
|
|
105
114
|
appInstance.plugins = {};
|
|
106
|
-
const appLog = log.initLog('web-engine', {
|
|
115
|
+
const appLog = log.initLog('web-engine', {
|
|
116
|
+
enabled: !!config.debug,
|
|
117
|
+
isBrowser,
|
|
118
|
+
color: 'cyan',
|
|
119
|
+
logFilter: config.logFilter,
|
|
120
|
+
truncateObjects: !isBrowser,
|
|
121
|
+
trace: TRACE,
|
|
122
|
+
});
|
|
107
123
|
|
|
108
124
|
appInstance.log = appLog.sublog(config.name);
|
|
109
|
-
appInstance.bus = bustle.create({
|
|
125
|
+
appInstance.bus = bustle.create({
|
|
126
|
+
showEvents: true,
|
|
127
|
+
reportAllErrors: true,
|
|
128
|
+
log: appLog,
|
|
129
|
+
});
|
|
110
130
|
|
|
111
131
|
appInstance.info = { wePkg: _package.default }; // web-engine package
|
|
112
132
|
|
|
113
|
-
if (typeof window !== 'undefined') {
|
|
133
|
+
if (typeof window !== 'undefined') {
|
|
134
|
+
// Prepare for non-browser environments
|
|
114
135
|
if (config.debug) {
|
|
115
136
|
appInstance.debug = R.map(fn => fn.bind(appInstance), debugTools);
|
|
116
137
|
debugTools.dndGo.call(appInstance); // setup DnD by default...
|
|
117
|
-
} else
|
|
118
|
-
appInstance.debug = { }; // no tools unless in debug mode.. (good idea?)
|
|
138
|
+
} else appInstance.debug = {}; // no tools unless in debug mode.. (good idea?)
|
|
119
139
|
|
|
120
140
|
window._app = appInstance;
|
|
121
|
-
if (window.document && window.document.title && config.setWindowTitle)
|
|
122
|
-
document.title = config.name;
|
|
141
|
+
if (window.document && window.document.title && config.setWindowTitle) document.title = config.name;
|
|
123
142
|
}
|
|
124
143
|
|
|
125
144
|
appInstance.env = env.buildEnv(appInstance);
|
|
126
145
|
|
|
127
|
-
if (config.theme) {
|
|
146
|
+
if (config.theme) {
|
|
147
|
+
// the following is only needed when UI is active - which requires a theme
|
|
128
148
|
await Zousan.evaluate(
|
|
129
149
|
{ name: 'ThemeManagerModule', value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) },
|
|
130
150
|
{ name: 'HistoryManager', value: Promise.resolve().then(function () { return require('./historyManager.js'); }) },
|
|
131
|
-
{ name: 'LayerManager', value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) }
|
|
151
|
+
{ name: 'LayerManager', value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) },
|
|
132
152
|
).then(async ({ LayerManager, HistoryManager, ThemeManagerModule }) => {
|
|
133
153
|
const ThemeManager = ThemeManagerModule.initThemeManager(appInstance);
|
|
134
154
|
appInstance.themePack = await ThemeManager.buildTheme(config.theme, config.defaultTheme);
|
|
@@ -138,17 +158,17 @@ async function create (rawConfig) {
|
|
|
138
158
|
|
|
139
159
|
appInstance.destroy = () => LayerManager.destroy(appInstance);
|
|
140
160
|
});
|
|
141
|
-
} else
|
|
142
|
-
appInstance.destroy = () => { }; // noop
|
|
161
|
+
} else appInstance.destroy = () => {}; // noop
|
|
143
162
|
|
|
144
163
|
if (config.plugins) {
|
|
145
164
|
for (const id in config.plugins) {
|
|
146
165
|
try {
|
|
147
166
|
const pluginConfig = config.plugins[id];
|
|
148
|
-
if (appInstance.plugins[id]) {
|
|
167
|
+
if (appInstance.plugins[id]) {
|
|
168
|
+
throw Error(`Duplicate plugin name "${id}"`);
|
|
169
|
+
}
|
|
149
170
|
const plugin = await setupPlugin(appInstance, id, pluginConfig);
|
|
150
|
-
if (plugin)
|
|
151
|
-
appInstance.plugins[id] = plugin;
|
|
171
|
+
if (plugin) appInstance.plugins[id] = plugin;
|
|
152
172
|
} catch (e) {
|
|
153
173
|
appLog.error('Error instantiating plugin ' + id);
|
|
154
174
|
appLog.error(e);
|
|
@@ -160,7 +180,7 @@ async function create (rawConfig) {
|
|
|
160
180
|
}
|
|
161
181
|
}
|
|
162
182
|
|
|
163
|
-
return appInstance
|
|
183
|
+
return appInstance;
|
|
164
184
|
}
|
|
165
185
|
|
|
166
186
|
exports.create = create;
|
|
@@ -23,39 +23,40 @@ const parmToPlugin = {
|
|
|
23
23
|
buildingId: 'mapRenderer',
|
|
24
24
|
floorId: 'mapRenderer',
|
|
25
25
|
visualTest: 'mapRenderer',
|
|
26
|
-
refInstallId: 'analytics2'
|
|
26
|
+
refInstallId: 'analytics2',
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
// Note: see note about security for forceCreate on postproc-stateTracking - same thing
|
|
30
30
|
// applies here!
|
|
31
|
-
function setDeepLinksForParms
|
|
31
|
+
function setDeepLinksForParms(config, parms, forceCreate) {
|
|
32
32
|
// allow for lldebug on the URL to set debug mode. I made it "lldebug" just so it wasn't SO easy to guess. ;-)
|
|
33
33
|
if (parms.has('lldebug')) {
|
|
34
34
|
try {
|
|
35
35
|
config.debug = JSON.parse(parms.get('lldebug'));
|
|
36
|
-
if (config.debug === null)
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
if (config.debug === null)
|
|
37
|
+
// allow for a URL parm of just `lldebug` (no value = null)
|
|
38
|
+
config.debug = {};
|
|
39
|
+
} catch (e) {
|
|
40
|
+
config.debug = true;
|
|
41
|
+
}
|
|
39
42
|
}
|
|
40
|
-
Object.keys(parmToPlugin)
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
plugins
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
});
|
|
43
|
+
Object.keys(parmToPlugin).forEach(key => {
|
|
44
|
+
if (parms.has(key)) {
|
|
45
|
+
let plugins = parmToPlugin[key];
|
|
46
|
+
if (!Array.isArray(plugins)) plugins = [plugins];
|
|
47
|
+
plugins.forEach(plugin => {
|
|
48
|
+
let pc = config.plugins[plugin]; // config for this plugin
|
|
49
|
+
if (!pc && forceCreate) pc = config.plugins[plugin] = {};
|
|
50
|
+
pc.deepLinkProps = { ...pc.deepLinkProps, [key]: parms.get(key) };
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
54
|
|
|
55
|
-
if (parms.has('poiId') && parms.has('showNav'))
|
|
55
|
+
if (parms.has('poiId') && parms.has('showNav'))
|
|
56
|
+
// poiId doubles as a parm for both - if showNav is defined, it should target getDirectionsFromTo only
|
|
56
57
|
delete config.plugins['online/poiView'].deepLinkProps.poiId;
|
|
57
58
|
|
|
58
|
-
return config
|
|
59
|
+
return config;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
exports.setDeepLinksForParms = setDeepLinksForParms;
|
|
@@ -37,25 +37,22 @@ var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
|
37
37
|
* @param {string} stateString stringified JSON object representing state
|
|
38
38
|
* @param {boolean} forceCreate if true, create any plugin entries if not found
|
|
39
39
|
*/
|
|
40
|
-
function setStateFromStateString
|
|
40
|
+
function setStateFromStateString(config, stateString, forceCreate) {
|
|
41
41
|
const state = JSON.parse(stateString);
|
|
42
42
|
|
|
43
43
|
// Iterate through each state object, which has a plugin id and key/value state props
|
|
44
44
|
Object.keys(state).forEach(id => {
|
|
45
45
|
const so = state[id];
|
|
46
46
|
let pluginConf = config.plugins[id];
|
|
47
|
-
if (!pluginConf && forceCreate)
|
|
48
|
-
pluginConf = config.plugins[id] = { };
|
|
47
|
+
if (!pluginConf && forceCreate) pluginConf = config.plugins[id] = {};
|
|
49
48
|
if (pluginConf) {
|
|
50
49
|
const curDLP = pluginConf.deepLinkProps;
|
|
51
|
-
if (!curDLP)
|
|
52
|
-
|
|
53
|
-
else
|
|
54
|
-
pluginConf.deepLinkProps = R__namespace.mergeDeepRight(curDLP, so);
|
|
50
|
+
if (!curDLP) pluginConf.deepLinkProps = so;
|
|
51
|
+
else pluginConf.deepLinkProps = R__namespace.mergeDeepRight(curDLP, so);
|
|
55
52
|
}
|
|
56
53
|
});
|
|
57
54
|
|
|
58
|
-
return config
|
|
55
|
+
return config;
|
|
59
56
|
}
|
|
60
57
|
|
|
61
58
|
exports.setStateFromStateString = setStateFromStateString;
|
|
@@ -14,17 +14,19 @@ var app = require('./app.js');
|
|
|
14
14
|
|
|
15
15
|
// This is a list of "instances" of your full app stack. Often this will be only one.
|
|
16
16
|
// If you wish to give it a name, use the appName property. Else one will be assigned.
|
|
17
|
-
const apps = {
|
|
17
|
+
const apps = {};
|
|
18
18
|
|
|
19
|
-
const sendAlert = msg => typeof window !== 'undefined' && window.alert ? window.alert(msg) : console.error(msg);
|
|
19
|
+
const sendAlert = msg => (typeof window !== 'undefined' && window.alert ? window.alert(msg) : console.error(msg));
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Create a new instance of the engine. Pass in a configuration object which will
|
|
23
23
|
* extend the config template.
|
|
24
24
|
* @param {} config Configuration for this instance. Will be shallow copied.
|
|
25
25
|
*/
|
|
26
|
-
async function create
|
|
27
|
-
if (!config) {
|
|
26
|
+
async function create(config) {
|
|
27
|
+
if (!config) {
|
|
28
|
+
throw Error('Attempt to create App instance with no configuration');
|
|
29
|
+
}
|
|
28
30
|
|
|
29
31
|
// If no name was defined for this instance, create one.
|
|
30
32
|
const appName = config.appName || 'Instance' + (Object.keys(apps).length + 1);
|
|
@@ -33,8 +35,11 @@ async function create (config) {
|
|
|
33
35
|
try {
|
|
34
36
|
const app$1 = await app.create(config);
|
|
35
37
|
apps[appName] = app$1;
|
|
36
|
-
return app$1
|
|
37
|
-
} catch (e) {
|
|
38
|
+
return app$1;
|
|
39
|
+
} catch (e) {
|
|
40
|
+
console.error(e);
|
|
41
|
+
e.message ? sendAlert(e.message) : sendAlert('Error creating map. Please try again later.');
|
|
42
|
+
}
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
exports.create = create;
|
|
@@ -24,8 +24,7 @@ function _interopNamespaceDefault(e) {
|
|
|
24
24
|
|
|
25
25
|
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
26
26
|
|
|
27
|
-
if (typeof window !== 'undefined')
|
|
28
|
-
window.R = R__namespace; // helps use Rambda in console... probably don't want to do this once we integrate with customer content
|
|
27
|
+
if (typeof window !== 'undefined') window.R = R__namespace; // helps use Rambda in console... probably don't want to do this once we integrate with customer content
|
|
29
28
|
|
|
30
29
|
// NOTE:
|
|
31
30
|
// The exported functions from this module all get placed into the app.debug (accessable from console via _app.debug) and bound to
|
|
@@ -33,66 +32,77 @@ if (typeof window !== 'undefined')
|
|
|
33
32
|
// the bus via `this.bus` or configuration via `this.config`
|
|
34
33
|
// Update: these are now also available in MoL by searching for `debug:<funcname>` - such as `debug:showIcons`
|
|
35
34
|
|
|
36
|
-
const showIcons = () => {
|
|
35
|
+
const showIcons = () => {
|
|
36
|
+
dom.$('#mapRenderDiv').innerHTML =
|
|
37
|
+
'<style> div { display: inline-block; text-align: center; border: 1px solid lightblue; }</style>' +
|
|
38
|
+
dom.$$('svg symbol')
|
|
39
|
+
.map(e => `<div><svg><use xlink:href="#${e.id}"/></svg><br/>${e.id}</div>`)
|
|
40
|
+
.join('');
|
|
41
|
+
};
|
|
37
42
|
|
|
38
|
-
function poisByCategory
|
|
39
|
-
return this.bus
|
|
43
|
+
function poisByCategory() {
|
|
44
|
+
return this.bus
|
|
45
|
+
.send('poi/getAll')
|
|
40
46
|
.then(r => r[0])
|
|
41
47
|
.then(p => Object.values(p))
|
|
42
|
-
.then(R__namespace.groupBy(o => o.category))
|
|
48
|
+
.then(R__namespace.groupBy(o => o.category));
|
|
43
49
|
}
|
|
44
50
|
|
|
45
|
-
const highlightNodes = () =>
|
|
51
|
+
const highlightNodes = () =>
|
|
52
|
+
dom.ad(
|
|
53
|
+
{
|
|
54
|
+
tag: 'style',
|
|
55
|
+
html: '* { background-color: rgba(255,0,0,.2); } * * { background-color: rgba(0,255,0,.2); } * * * { background-color: rgba(0,0,255,.2); } * * * * { background-color: rgba(255,0,255,.2); } * * * * * { background-color: rgba(0,255,255,.2); } * * * * * * { background-color: rgba(255,255,0,.2); } * * * * * * * { background-color: rgba(255,0,0,.2); } * * * * * * * * { background-color: rgba(0,255,0,.2); } * * * * * * * * * { background-color: rgba(0,0,255,.2); }',
|
|
56
|
+
},
|
|
57
|
+
dom.$('head'),
|
|
58
|
+
);
|
|
46
59
|
|
|
47
|
-
function getPoiById
|
|
48
|
-
return this.bus.send('poi/getById', { id })
|
|
49
|
-
.then(r => r[0])
|
|
60
|
+
function getPoiById(id) {
|
|
61
|
+
return this.bus.send('poi/getById', { id }).then(r => r[0]);
|
|
50
62
|
}
|
|
51
63
|
|
|
52
|
-
async function showOrphaned
|
|
64
|
+
async function showOrphaned() {
|
|
53
65
|
const navGraph = await this.bus.get('wayfinder/_getNavGraph');
|
|
54
66
|
const oob = navGraphDebug.orphanTest(navGraph._nodes);
|
|
55
67
|
this.bus.send('map/showOrphanedGraphNodes', { orphanedNodes: oob.orphaned });
|
|
56
68
|
}
|
|
57
69
|
|
|
58
|
-
async function showgraph
|
|
70
|
+
async function showgraph() {
|
|
59
71
|
const navGraph = await this.bus.get('wayfinder/getNavGraphFeatures');
|
|
60
72
|
this.bus.send('map/showNavGraphFeatures', { navGraph });
|
|
61
73
|
monitorDebugFeaturesReset('map/resetNavGraphFeatures', this.bus);
|
|
62
74
|
}
|
|
63
75
|
|
|
64
|
-
async function bounds
|
|
76
|
+
async function bounds() {
|
|
65
77
|
const venueCenter = await this.bus.get('venueData/getVenueCenter');
|
|
66
78
|
const { venueRadius, bounds } = await this.bus.get('venueData/getVenueData');
|
|
67
79
|
this.bus.send('map/showVenueBounds', { venueCenter, venueRadius, bounds });
|
|
68
80
|
monitorDebugFeaturesReset('map/resetVenueBounds', this.bus);
|
|
69
81
|
}
|
|
70
82
|
|
|
71
|
-
async function buildingBounds
|
|
83
|
+
async function buildingBounds(nameFilter) {
|
|
72
84
|
this.bus.send('map/showBuildingBounds', { nameFilter });
|
|
73
85
|
monitorDebugFeaturesReset('map/resetVenueBounds', this.bus);
|
|
74
86
|
showCenter.apply(this);
|
|
75
87
|
}
|
|
76
88
|
|
|
77
|
-
async function floorBounds
|
|
89
|
+
async function floorBounds(nameFilter) {
|
|
78
90
|
const bus = this.bus;
|
|
79
91
|
bus.send('map/showFloorBounds', { nameFilter });
|
|
80
92
|
|
|
81
93
|
monitorDebugFeaturesReset('map/resetVenueBounds', bus);
|
|
82
94
|
|
|
83
|
-
const unsubFloorChanges = bus.monitor('map/floorChanged', () =>
|
|
84
|
-
bus.send('map/showFloorBounds', { nameFilter }));
|
|
95
|
+
const unsubFloorChanges = bus.monitor('map/floorChanged', () => bus.send('map/showFloorBounds', { nameFilter }));
|
|
85
96
|
onNextSearchClear(unsubFloorChanges, bus);
|
|
86
97
|
showCenter.apply(this);
|
|
87
98
|
}
|
|
88
99
|
|
|
89
|
-
async function padding
|
|
100
|
+
async function padding() {
|
|
90
101
|
this.bus.send('map/togglePadding');
|
|
91
102
|
monitorDebugFeaturesReset('map/togglePadding', this.bus);
|
|
92
103
|
}
|
|
93
104
|
|
|
94
|
-
const monitorDebugFeaturesReset = (resetEventName, bus) =>
|
|
95
|
-
onNextSearchClear(() => bus.send(resetEventName), bus);
|
|
105
|
+
const monitorDebugFeaturesReset = (resetEventName, bus) => onNextSearchClear(() => bus.send(resetEventName), bus);
|
|
96
106
|
|
|
97
107
|
const onNextSearchClear = (fn, bus) => {
|
|
98
108
|
const unsubscribe = bus.monitor('homeview/performSearch', ({ term }) => {
|
|
@@ -103,47 +113,64 @@ const onNextSearchClear = (fn, bus) => {
|
|
|
103
113
|
});
|
|
104
114
|
};
|
|
105
115
|
|
|
106
|
-
async function showCenter
|
|
116
|
+
async function showCenter() {
|
|
107
117
|
const padding = await this.bus.get('map/getPadding');
|
|
108
118
|
const leftAdj = (padding.left - padding.right) / 2; // how much to adjust left from true center to account for padding
|
|
109
119
|
const topAdj = (padding.top - padding.bottom) / 2; // how much to adjust top from true center to account for padding
|
|
110
|
-
const crosshair = dom.ad(
|
|
120
|
+
const crosshair = dom.ad(
|
|
121
|
+
{
|
|
122
|
+
html: `<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><path stroke="#fF000080" stroke-width="2" d="M0 50h45M55 50h45M50 0v45M50 55v45"/></svg>`,
|
|
123
|
+
styles: {
|
|
124
|
+
position: 'absolute',
|
|
125
|
+
left: '50%',
|
|
126
|
+
top: '50%',
|
|
127
|
+
'margin-left': -50 + leftAdj + 'px',
|
|
128
|
+
'margin-top': -50 + topAdj + 'px',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
dom.$('.maplibregl-map'),
|
|
132
|
+
);
|
|
111
133
|
onNextSearchClear(() => dom.del(crosshair), this.bus);
|
|
112
134
|
}
|
|
113
135
|
|
|
114
|
-
function dndGo
|
|
136
|
+
function dndGo() {
|
|
115
137
|
const bus = this.bus;
|
|
116
138
|
const toggleActive = (e, indicateDragVisual) => {
|
|
117
139
|
e.preventDefault();
|
|
118
|
-
if (indicateDragVisual)
|
|
119
|
-
|
|
120
|
-
else
|
|
121
|
-
e.target.classList.remove('dragover');
|
|
140
|
+
if (indicateDragVisual) e.target.classList.add('dragover');
|
|
141
|
+
else e.target.classList.remove('dragover');
|
|
122
142
|
};
|
|
123
143
|
|
|
124
144
|
const handlers = {
|
|
125
|
-
|
|
126
145
|
drop: async function (e) {
|
|
127
146
|
toggleActive(e, false);
|
|
128
147
|
|
|
129
148
|
// Load the file into the player
|
|
130
149
|
for (const file of e.dataTransfer.files) {
|
|
131
150
|
const filename = file.name;
|
|
132
|
-
if (file.type === 'application/json' ||
|
|
151
|
+
if (file.type === 'application/json' || file.type.startsWith('text/')) {
|
|
133
152
|
const reader = new FileReader();
|
|
134
153
|
reader.onload = funcs.singleFile(async e =>
|
|
135
|
-
bus.send(`debugTools/fileDrop`, {
|
|
154
|
+
bus.send(`debugTools/fileDrop`, {
|
|
155
|
+
file,
|
|
156
|
+
filename,
|
|
157
|
+
content: e.target.result,
|
|
158
|
+
}),
|
|
159
|
+
);
|
|
136
160
|
reader.readAsText(file);
|
|
137
161
|
}
|
|
138
162
|
}
|
|
139
163
|
},
|
|
140
164
|
|
|
141
165
|
// Drag-over event
|
|
142
|
-
dragover: function (e) {
|
|
166
|
+
dragover: function (e) {
|
|
167
|
+
toggleActive(e, true);
|
|
168
|
+
},
|
|
143
169
|
|
|
144
170
|
// Drag-leave event
|
|
145
|
-
dragleave: function (e) {
|
|
146
|
-
|
|
171
|
+
dragleave: function (e) {
|
|
172
|
+
toggleActive(e, false);
|
|
173
|
+
},
|
|
147
174
|
}; // end of handlers def
|
|
148
175
|
|
|
149
176
|
Object.keys(handlers).forEach(function (event) {
|
|
@@ -166,7 +193,7 @@ var debugTools = {
|
|
|
166
193
|
showCenter,
|
|
167
194
|
showgraph,
|
|
168
195
|
showIcons,
|
|
169
|
-
showOrphaned
|
|
196
|
+
showOrphaned,
|
|
170
197
|
};
|
|
171
198
|
|
|
172
199
|
module.exports = debugTools;
|
package/dist/cjs/src/env.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function buildEnv
|
|
3
|
+
function buildEnv(app) {
|
|
4
4
|
const desktopViewMinWidth = app.config.desktopViewMinWidth || 0; // default to desktop view for all sizes
|
|
5
5
|
const isBrowser = typeof window !== 'undefined';
|
|
6
6
|
|
|
@@ -24,15 +24,18 @@ function buildEnv (app) {
|
|
|
24
24
|
isMobileReflow,
|
|
25
25
|
isLocalhost,
|
|
26
26
|
isDesktop,
|
|
27
|
-
supportsTouch
|
|
27
|
+
supportsTouch,
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
if (isBrowser)
|
|
31
31
|
window.addEventListener('resize', () => {
|
|
32
|
-
app.bus.send('env/resize', {
|
|
32
|
+
app.bus.send('env/resize', {
|
|
33
|
+
isMobile: env.isMobile(),
|
|
34
|
+
isMobileReflow: env.isMobileReflow(),
|
|
35
|
+
});
|
|
33
36
|
});
|
|
34
37
|
|
|
35
|
-
return env
|
|
38
|
+
return env;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
exports.buildEnv = buildEnv;
|