✨ MAJOR FEATURES: • Auto-zoom intelligence với smart bounds fitting • Enhanced 3D GPS markers với pulsing effects • Professional route display với 6-layer rendering • Status-based parking icons với availability indicators • Production-ready build optimizations 🗺️ AUTO-ZOOM FEATURES: • Smart bounds fitting cho GPS + selected parking • Adaptive padding (50px) cho visual balance • Max zoom control (level 16) để tránh quá gần • Dynamic centering khi không có selection 🎨 ENHANCED VISUALS: • 3D GPS marker với multi-layer pulse effects • Advanced parking icons với status colors • Selection highlighting với animation • Dimming system cho non-selected items 🛣️ ROUTE SYSTEM: • OpenRouteService API integration • Multi-layer route rendering (glow, shadow, main, animated) • Real-time distance & duration calculation • Visual route info trong popup 📱 PRODUCTION READY: • SSR safe với dynamic imports • Build errors resolved • Global deployment via Vercel • Optimized performance 🌍 DEPLOYMENT: • Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app • Bundle size: 22.8 kB optimized • Global CDN distribution • HTTPS enabled 💾 VERSION CONTROL: • MapView-v2.0.tsx backup created • MAPVIEW_VERSIONS.md documentation • Full version history tracking
80 lines
2.2 KiB
JavaScript
80 lines
2.2 KiB
JavaScript
'use strict'
|
|
|
|
// like String.prototype.search but returns the last index
|
|
function _searchLast (str, rgx) {
|
|
const matches = Array.from(str.matchAll(rgx))
|
|
return matches.length > 0 ? matches.slice(-1)[0].index : -1
|
|
}
|
|
|
|
function _interpolate (envValue, environment, config) {
|
|
// find the last unescaped dollar sign in the
|
|
// value so that we can evaluate it
|
|
const lastUnescapedDollarSignIndex = _searchLast(envValue, /(?!(?<=\\))\$/g)
|
|
|
|
// If we couldn't match any unescaped dollar sign
|
|
// let's return the string as is
|
|
if (lastUnescapedDollarSignIndex === -1) return envValue
|
|
|
|
// This is the right-most group of variables in the string
|
|
const rightMostGroup = envValue.slice(lastUnescapedDollarSignIndex)
|
|
|
|
/**
|
|
* This finds the inner most variable/group divided
|
|
* by variable name and default value (if present)
|
|
* (
|
|
* (?!(?<=\\))\$ // only match dollar signs that are not escaped
|
|
* {? // optional opening curly brace
|
|
* ([\w]+) // match the variable name
|
|
* (?::-([^}\\]*))? // match an optional default value
|
|
* }? // optional closing curly brace
|
|
* )
|
|
*/
|
|
const matchGroup = /((?!(?<=\\))\${?([\w]+)(?::-([^}\\]*))?}?)/
|
|
const match = rightMostGroup.match(matchGroup)
|
|
|
|
if (match != null) {
|
|
const [, group, variableName, defaultValue] = match
|
|
|
|
return _interpolate(
|
|
envValue.replace(
|
|
group,
|
|
environment[variableName] ||
|
|
defaultValue ||
|
|
config.parsed[variableName] ||
|
|
''
|
|
),
|
|
environment,
|
|
config
|
|
)
|
|
}
|
|
|
|
return envValue
|
|
}
|
|
|
|
function _resolveEscapeSequences (value) {
|
|
return value.replace(/\\\$/g, '$')
|
|
}
|
|
|
|
function expand (config) {
|
|
// if ignoring process.env, use a blank object
|
|
const environment = config.ignoreProcessEnv ? {} : process.env
|
|
|
|
for (const configKey in config.parsed) {
|
|
const value = Object.prototype.hasOwnProperty.call(environment, configKey)
|
|
? environment[configKey]
|
|
: config.parsed[configKey]
|
|
|
|
config.parsed[configKey] = _resolveEscapeSequences(
|
|
_interpolate(value, environment, config)
|
|
)
|
|
}
|
|
|
|
for (const processKey in config.parsed) {
|
|
environment[processKey] = config.parsed[processKey]
|
|
}
|
|
|
|
return config
|
|
}
|
|
|
|
module.exports.expand = expand
|