Files
Laca-City/frontend/node_modules/@next/eslint-plugin-next/dist/rules/no-page-custom-font.js
PhongPham c65cc97a33 🎯 MapView v2.0 - Global Deployment Ready
 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
2025-07-20 19:52:16 +07:00

127 lines
6.2 KiB
JavaScript

"use strict";
var _definerule = require("../utils/define-rule");
var _nodeattributes = /*#__PURE__*/ _interop_require_default(require("../utils/node-attributes"));
var _path = require("path");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
var url = "https://nextjs.org/docs/messages/no-page-custom-font";
function isIdentifierMatch(id1, id2) {
return id1 === null && id2 === null || id1 && id2 && id1.name === id2.name;
}
module.exports = (0, _definerule.defineRule)({
meta: {
docs: {
description: "Prevent page-only custom fonts.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
var paths = context.getFilename().split("pages");
var page = paths[paths.length - 1];
// outside of a file within `pages`, bail
if (!page) {
return {};
}
var is_Document = page.startsWith("".concat(_path.sep, "_document")) || page.startsWith("".concat(_path.posix.sep, "_document"));
var documentImportName;
var localDefaultExportId;
var exportDeclarationType;
return {
ImportDeclaration: function ImportDeclaration(node) {
if (node.source.value === "next/document") {
var documentImport = node.specifiers.find(function(param) {
var type = param.type;
return type === "ImportDefaultSpecifier";
});
if (documentImport && documentImport.local) {
documentImportName = documentImport.local.name;
}
}
},
ExportDefaultDeclaration: function ExportDefaultDeclaration(node) {
exportDeclarationType = node.declaration.type;
if (node.declaration.type === "FunctionDeclaration") {
localDefaultExportId = node.declaration.id;
return;
}
if (node.declaration.type === "ClassDeclaration" && node.declaration.superClass && "name" in node.declaration.superClass && node.declaration.superClass.name === documentImportName) {
localDefaultExportId = node.declaration.id;
}
},
JSXOpeningElement: function JSXOpeningElement(node) {
if (node.name.name !== "link") {
return;
}
var ancestors = context.getAncestors();
// if `export default <name>` is further down within the file after the
// currently traversed component, then `localDefaultExportName` will
// still be undefined
if (!localDefaultExportId) {
// find the top level of the module
var program = ancestors.find(function(ancestor) {
return ancestor.type === "Program";
});
// go over each token to find the combination of `export default <name>`
for(var i = 0; i <= program.tokens.length - 1; i++){
if (localDefaultExportId) {
break;
}
var token = program.tokens[i];
if (token.type === "Keyword" && token.value === "export") {
var nextToken = program.tokens[i + 1];
if (nextToken && nextToken.type === "Keyword" && nextToken.value === "default") {
var maybeIdentifier = program.tokens[i + 2];
if (maybeIdentifier && maybeIdentifier.type === "Identifier") {
localDefaultExportId = {
name: maybeIdentifier.value
};
}
}
}
}
}
var parentComponent = ancestors.find(function(ancestor) {
// export default class ... extends ...
if (exportDeclarationType === "ClassDeclaration") {
return ancestor.type === exportDeclarationType && "superClass" in ancestor && ancestor.superClass && "name" in ancestor.superClass && ancestor.superClass.name === documentImportName;
}
if ("id" in ancestor) {
// export default function ...
if (exportDeclarationType === "FunctionDeclaration") {
return ancestor.type === exportDeclarationType && isIdentifierMatch(ancestor.id, localDefaultExportId);
}
// function ...() {} export default ...
// class ... extends ...; export default ...
return isIdentifierMatch(ancestor.id, localDefaultExportId);
}
return false;
});
// file starts with _document and this <link /> is within the default export
if (is_Document && parentComponent) {
return;
}
var attributes = new _nodeattributes.default(node);
if (!attributes.has("href") || !attributes.hasValue("href")) {
return;
}
var hrefValue = attributes.value("href");
var isGoogleFont = typeof hrefValue === "string" && hrefValue.startsWith("https://fonts.googleapis.com/css");
if (isGoogleFont) {
var end = "This is discouraged. See: ".concat(url);
var message = is_Document ? "Using `<link />` outside of `<Head>` will disable automatic font optimization. ".concat(end) : "Custom fonts not added in `pages/_document.js` will only load for a single page. ".concat(end);
context.report({
node: node,
message: message
});
}
}
};
}
});