Fix code quality violations and enhance ROUTE-EXISTS-01 rule

Implement JQHTML function cache ID system and fix bundle compilation
Implement underscore prefix for system tables
Fix JS syntax linter to support decorators and grant exception to Task system
SPA: Update planning docs and wishlists with remaining features
SPA: Document Navigation API abandonment and future enhancements
Implement SPA browser integration with History API (Phase 1)
Convert contacts view page to SPA action
Convert clients pages to SPA actions and document conversion procedure
SPA: Merge GET parameters and update documentation
Implement SPA route URL generation in JavaScript and PHP
Implement SPA bootstrap controller architecture
Add SPA routing manual page (rsx:man spa)
Add SPA routing documentation to CLAUDE.md
Phase 4 Complete: Client-side SPA routing implementation
Update get_routes() consumers for unified route structure
Complete SPA Phase 3: PHP-side route type detection and is_spa flag
Restore unified routes structure and Manifest_Query class
Refactor route indexing and add SPA infrastructure
Phase 3 Complete: SPA route registration in manifest
Implement SPA Phase 2: Extract router code and test decorators
Rename Jqhtml_Component to Component and complete SPA foundation setup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-19 17:48:15 +00:00
parent 77b4d10af8
commit 9ebcc359ae
4360 changed files with 37751 additions and 18578 deletions

View File

@@ -42,20 +42,6 @@ class JqhtmlFormattingEditProvider {
// This formatter uses string manipulation and indexOf for reliability
// Regex should only be used in the syntax highlighter, not here
// Based on the RS3 formatter (reformat_html.php) logic
// Patterns that increase indent on the NEXT line
this.indentIncrease = [': %>', ': ?>', '{ %>', '{ ?>'];
// Patterns that decrease indent
this.indentDecrease = [
'<% end; %>',
'<% endif; %>',
'<% endfor; %>',
'<% endforeach; %>',
'<% endfunction; %>',
'<% } %>',
'<% }); %>',
'<% } else',
'<% else'
];
// Known self-closing HTML tags
this.selfClosingTags = [
'area', 'base', 'br', 'embed', 'hr', 'iframe',
@@ -73,7 +59,24 @@ class JqhtmlFormattingEditProvider {
const safeCode = [];
let working = text;
let reading = text;
// Step 1: Escape HTML comments
// Step 1: Escape JQHTML comments (<%-- --%>)
working = '';
while (reading.indexOf('<%--') !== -1) {
const pos = reading.indexOf('<%--');
working += reading.substring(0, pos);
reading = reading.substring(pos);
const closePos = reading.indexOf('--%>');
if (closePos === -1) {
// Parse error, return original
return text;
}
safeCode.push(reading.substring(0, closePos + 4));
reading = reading.substring(closePos + 4);
working += '@@__SAFE__(' + (safeCode.length - 1) + ')';
}
working += reading;
reading = working;
// Step 2: Escape HTML comments (<!-- -->)
working = '';
while (reading.indexOf('<!--') !== -1) {
const pos = reading.indexOf('<!--');
@@ -90,7 +93,7 @@ class JqhtmlFormattingEditProvider {
}
working += reading;
reading = working;
// Step 2: Escape multiline <% %> blocks
// Step 3: Escape multiline <% %> blocks
working = '';
while (reading.indexOf('<%') !== -1) {
const pos = reading.indexOf('<%');
@@ -114,48 +117,62 @@ class JqhtmlFormattingEditProvider {
working += '@@__SAFE__(' + (safeCode.length - 1) + ')';
}
working += reading;
// Step 3: Split into lines with indent levels
// Step 4: Split into lines with indent levels
const lines = [];
const splitLines = working.split('\n');
for (const line of splitLines) {
lines.push([0, line.trim()]);
}
// Step 4: Handle JS/control flow indents (if:, endif;, etc)
// Step 5: Handle JS/control flow indents by counting braces
let jsIndent = 0;
for (let i = 0; i < lines.length; i++) {
const trimmedLine = lines[i][1];
let plus = 0;
let minus = 0;
// Check for indent increase patterns
for (const pattern of this.indentIncrease) {
if (trimmedLine.indexOf(pattern) !== -1) {
plus++;
}
}
// Check for indent decrease patterns
for (const pattern of this.indentDecrease) {
if (trimmedLine.indexOf(pattern) !== -1) {
minus++;
// Count opening and closing braces within <% %> blocks
let openBraces = 0;
let closeBraces = 0;
// Find all <% %> blocks in the line
let searchPos = 0;
while (true) {
const startPos = trimmedLine.indexOf('<%', searchPos);
if (startPos === -1)
break;
const endPos = trimmedLine.indexOf('%>', startPos);
if (endPos === -1)
break;
// Extract the code block content
const codeBlock = trimmedLine.substring(startPos + 2, endPos);
// Count braces in this code block
for (let j = 0; j < codeBlock.length; j++) {
if (codeBlock[j] === '{')
openBraces++;
if (codeBlock[j] === '}')
closeBraces++;
}
searchPos = endPos + 2;
}
const netChange = openBraces - closeBraces;
// Apply indent changes
if (plus > minus) {
if (netChange > 0) {
// Opening braces - indent applies to next line
lines[i][0] = jsIndent;
jsIndent += netChange;
}
else if (netChange < 0) {
// Closing braces - dedent this line
jsIndent += netChange;
lines[i][0] = jsIndent;
jsIndent += plus;
jsIndent -= minus;
}
else {
jsIndent += plus;
jsIndent -= minus;
// No change
lines[i][0] = jsIndent;
}
// Special handling for else statements
if (trimmedLine.startsWith('<% else') ||
trimmedLine.startsWith('<% } else')) {
// Special handling for else statements - dedent by 1
if (trimmedLine.indexOf('<% else') !== -1 ||
trimmedLine.indexOf('<% } else') !== -1) {
lines[i][0]--;
}
}
// Step 5: Escape remaining single-line code blocks
// Step 6: Escape remaining single-line code blocks
for (let i = 0; i < lines.length; i++) {
reading = lines[i][1];
working = '';
@@ -177,7 +194,7 @@ class JqhtmlFormattingEditProvider {
working += reading;
lines[i][1] = working;
}
// Step 6: Handle HTML tag indents
// Step 7: Handle HTML tag indents
let htmlIndent = 0;
let openSelfClosingTag = null; // Track if we're inside a multiline self-closing tag
for (let i = 0; i < lines.length; i++) {
@@ -246,7 +263,7 @@ class JqhtmlFormattingEditProvider {
lines[i][0]++;
}
}
// Step 7: Build result with proper indentation
// Step 8: Build result with proper indentation
let result = '';
for (const [indent, line] of lines) {
const finalIndent = Math.max(0, indent);
@@ -257,7 +274,7 @@ class JqhtmlFormattingEditProvider {
result += '\n';
}
}
// Step 8: Restore safe blocks
// Step 9: Restore safe blocks
for (let attempt = 0; attempt < 10; attempt++) {
let hasChanges = false;
for (let i = 0; i < safeCode.length; i++) {
@@ -271,7 +288,7 @@ class JqhtmlFormattingEditProvider {
break;
}
}
// Step 9: Add blank lines around Define tag contents
// Step 10: Add blank lines around Define tag contents
result = this.addDefineTagSpacing(result);
return result.trim();
}

File diff suppressed because one or more lines are too long